我希望能够将多个应用程序根组件引导到我的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上运行。
提前致谢。
我希望能够将多个应用程序根组件引导到我的index.html页面中。在Angular 2 beta 0-15版本中,这是可以实现的,但是从beta 16开始,它不再起作用。请参考此代码 http://plnkr.co/edit/A7fyFUST9IdP1FriauXk?p=preview
please see plunker link above for the code
提前致谢。
列出所有bootstrap
(和declarations
)中的组件。
@NgModule({
imports: [ BrowserModule ],
declarations: [ App, ModalComponent, CompComponent],
providers: [SharedService],
entryComponents: [CompComponent],
bootstrap: [ App, ModalComponent ]
})
export class AppModule{}
另请参见如何将 Bootstrap 模态框作为 Angular2 组件动态创建以获取完整示例。
http://plnkr.co/edit/APFwcpOGsMlOMVdGCkCI
随着新版本的推出,这已经变得更加容易了:
bootstrap(Comp1);
bootstrap(Comp2);
这里提供了一个更高级的实现应用程序之间通信的示例: http://plnkr.co/edit/aZqdJe3OZ8K2odHioWkB