ANALYZE_FOR_ENTRY_COMPONENTS

ANALYZE_FOR_ENTRY_COMPONENTS

Experimental Const

Variable Export

export ANALYZE_FOR_ENTRY_COMPONENTS

This token can be used to create a virtual provider that will populate the entryComponents fields of components and ng modules based on its useValue. All components that are referenced in the useValue value (either directly or in a nested array or map) will be added to the entryComponents property.

Example

The following example shows how the router can populate the entryComponents field of an NgModule based on the router configuration which refers to components.

// helper function inside the router
function provideRoutes(routes) {
  return [
    {provide: ROUTES, useValue: routes},
    {provide: ANALYZE_FOR_ENTRY_COMPONENTS, useValue: routes, multi: true}
  ];
}

// user code
let routes = [
  {path: '/root', component: RootComp},
  {path: '/teams', component: TeamsComp}
];

@NgModule({
  providers: [provideRoutes(routes)]
})
class ModuleWithRoutes {}

exported from @angular-core-index defined in @angular/core/src/metadata/di.ts

© 2010–2017 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://v2.angular.io/docs/ts/latest/api/core/index/ANALYZE_FOR_ENTRY_COMPONENTS-let.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部