我刚刚将Angular2项目更新为RC4,当我打开应用程序时,路由器现在在控制台中发出此警告消息:
router.umd.js:2466 'FrontpageComponent' not found in precompile array. To ensure all components referred to by the RouterConfig are compiled, you must add 'FrontpageComponent' to the 'precompile' array of your application component. This will be required in a future release of the router.
Run Code Online (Sandbox Code Playgroud)
我试图找出我需要做些什么来解决这个问题,但由于文档很少,我找不到答案.什么是这个预编译数组,我在哪里可以找到它或如何添加它?
Gün*_*uer 22
在较新的路由器版本中,这不再是必需的.
<= RC.4
它只是@Component()或@Directive()装饰器的附加参数:
@Component({
selector: '...',
template: '...',
directives: [FrontpageComponent],
precompile: [FrontpageCmponent]
})
Run Code Online (Sandbox Code Playgroud)
/**
*定义
*此组件定义时应预编译的组件.对于此处列出的每个组件,
*Angular将创建一个{@link ComponentFactory ComponentFactory}并将其存储在
*{@link ComponentFactoryResolver ComponentFactoryResolver}中.
| 归档时间: |
|
| 查看次数: |
9030 次 |
| 最近记录: |