What is the significance of imports metadata of ngmodule decorator, when we are importing files at top. Difference between both the inputs.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
These imports are entirely different concepts.
The imports at the top of the file are TypeScript imports to make classes, interfaces and variables known to the current file and are not related to Angular2.
The @NgModule()
imports are to make exports: []
of the imported @NgModule()
s known to the importing @NgModule()
so that they applied to components of the importing module if selectors match.
Also providers: []
of an imported module are added to the root scope of the injector (only when the module is not lazy loaded).