Angular 2引导多个根组件

7

我希望能够将多个应用程序根组件引导到我的index.html页面中。在Angular 2 beta 0-15版本中,这是可以实现的,但是从beta 16开始,它不再起作用。请参考此代码 http://plnkr.co/edit/A7fyFUST9IdP1FriauXk?p=preview

please see plunker link above for the code

希望有人能够修改代码,使其能够在Angular 2 beta 17上运行。

提前致谢。

2个回答

5

列出所有bootstrap(和declarations)中的组件。

@NgModule({
  imports: [ BrowserModule ],
  declarations: [ App, ModalComponent, CompComponent],
  providers: [SharedService],
  entryComponents: [CompComponent],
  bootstrap: [ App, ModalComponent ]
})
export class AppModule{}

另请参见如何将 Bootstrap 模态框作为 Angular2 组件动态创建以获取完整示例。


3

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接