我真的迷上了RC6 of angular2。
我没有设法用模块和组件来调整我的代码,也不理解两者之间的区别。你能帮我集成指令,提供者,导入大规模的应用程序吗?
谷歌的文档还不太清楚。
提前谢谢。
干杯
发布于 2016-12-23 14:03:25
基本上,在Angular2中,您有:
1. Imports : An array where you import the Angular2 Modules (Forms, etc.) and your next modules (DashboardModule, AdminModule, AuthentificationModule, etc.) as well as the Routing logic involved between your components.
2. Declarations : An array where you declare the components that are linked to that module.
3. Provider : An array where you declare your services or directives that are to be used with this module
我试图用我自己的话来解释这一点,所以在几个层次上它是不准确的,这就是为什么您有像angular.io这样的文档站点。希望这能有所帮助。
关于模块=> https://angular.io/docs/ts/latest/guide/ngmodule.html的正式文档
发布于 2018-05-26 22:13:12
忘了那些无聊的技术规范吧,他们只是把你弄糊涂了。我不认为有这样的必要有两个概念,因为在编程语言中,它们可以互换地被引用,就像我们所说的车辆和汽车。关于Angular2的许多文章在进行实际编码之前,都不会将它们区分开来进行一般性讨论。
但是,在查看代码时,这里有两个关键的区别:
这意味着组件是Angular2结构中的叶级.这是一个非常好的解释。
https://stackoverflow.com/questions/41289463
复制相似问题