如何在同一页面中多次使用AngularJS 2组件?

Ous*_*udi 8 javascript angular

在使用选择器声明组件后'some-comp',<some-comp></some-comp>在页面中使用只能使用一次.我想在任何帮助下多次使用它,这是一个示例代码:

@Component({ selector: 'some-comp' })
@View({ template: 'component template' })
class SomeComponent {    }
bootstrap(SomeComponent);
Run Code Online (Sandbox Code Playgroud)

uno*_*obf 5

引导组件实际上应该被视为一个应用程序,如果你想多次使用同一个组件,你需要将它变成一个指令,然后在你引导的应用程序中包含该指令.

以此菜单组件为例,您将看到<aria-menuitem>多次使用的组件以及<aria-menu>组件.

https://github.com/dylanb/Axponents/tree/master/angular2