【发布时间】:2017-06-27 22:49:15
【问题描述】:
我一直在阅读 Angular 教程,并在阅读 HTTP 部分 https://angular.io/docs/ts/latest/tutorial/toh-pt6.html 时注意到,在 NgModule 中声明导入的顺序会影响应用程序是否正常工作。我想知道为什么会这样。
这尤其有效:
@NgModule({ 进口:[ 浏览器模块, 表单模块, Http模块, InMemoryWebApiModule.forRoot(InMemoryDataService), 应用路由模块 ], ... })但以下没有。英雄列表没有加载。请注意,HttpModule 是在 InMemoryWebApiModule 之后声明的:
@NgModule({ 进口:[ 浏览器模块, 表单模块, InMemoryWebApiModule.forRoot(InMemoryDataService), Http模块, 应用路由模块 ], ... })本教程使用 Angular 2.4.4。我在 Firefox 和 IE 中都注意到了这个问题。我在 Google 搜索中没有发现任何可以表明问题根源的内容。
【问题讨论】:
标签: angular