T-student T-student - 1 year ago 149
TypeScript Question

Angular2 component with selector not in the html

in the following pluker http://plnkr.co/edit/MC7gO55TGkQTrxaJnJir?p=preview

in the DashboardComponent class, in the file


is defined a @component with a selector but in the file .html
there is no selector equivalent, you can explain me how is possible?
you are not forced to define the selector tag ?

Answer Source

The router uses ViewContainerRef.createComponent() which doesn't need the selector to match HTML. See also Angular 2 dynamic tabs with user-click chosen components for an example.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download