-1

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

in the DashboardComponent class, in the file

 Dashboard.Component.ts 

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 ?

FrankTan
  • 1,626
  • 6
  • 28
  • 63

3 Answers3

3

The DashboardComponent is used in the Router. A router component does not need a selector property.

Poul Kruijt
  • 69,713
  • 12
  • 145
  • 149
2

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.

Community
  • 1
  • 1
Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
0

The Angular router lets you route to a component directly - have a look at app/app-routing.module.ts: { path: 'dashboard', component: DashboardComponent },

See the "Add Routing" link of this for more detail: https://angular.io/docs/ts/latest/tutorial/toh-pt5.html

Alcinator
  • 287
  • 1
  • 6