After declaring a component with selector 'some-comp'
, using <some-comp></some-comp>
in a page will only work once. I would like to use it multiple times any help, here is an example code:
@Component({ selector: 'some-comp' })
@View({ template: 'component template' })
class SomeComponent { }
bootstrap(SomeComponent);
The bootstrapped Component is really to be looked at as an app, if you want to use the same component multiple times, you will want to make it into a directive and then include that directive in your app which you bootstrap.
Look at this menu component as an example, you will see the <aria-menuitem>
components used multiple times as well as the <aria-menu>
components.
https://github.com/dylanb/Axponents/tree/master/angular2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With