加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

angular2 – 什么是所有index.ts用于?

发布时间:2020-12-17 08:41:42 所属栏目:安全 来源:网络整理
导读:我一直在看几个种子项目,所有的组件似乎有一个index.ts从该组件输出*。我不能在任何地方找到它实际使用的是什么? 例如https://github.com/mgechev/angular2-seed/tree/master/src/client/app/%2Bhome 谢谢 从 https://angular.io/docs/ts/latest/guide/glo
我一直在看几个种子项目,所有的组件似乎有一个index.ts从该组件输出*。我不能在任何地方找到它实际使用的是什么?

例如https://github.com/mgechev/angular2-seed/tree/master/src/client/app/%2Bhome

谢谢

从 https://angular.io/docs/ts/latest/guide/glossary.html桶

A barrel is a way to rollup exports from several modules into a single
convenience module. The barrel itself is a module file that re-exports
selected exports of other modules.

Imagine three modules in a heroes folder:

06000

Without a barrel,a consumer would need three import statements:

06001

We can add a barrel to the heroes folder (called index by convention)
that exports all of these items:

06002

Now a consumer can import what it needs from the barrel.

06003

The Angular scoped packages each have a barrel named index.

参见Angular 2 DI Error – EXCEPTION: Can’t resolve all parameters

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读