-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 ?

T-student
  • 1,554
  • 5
  • 27
  • 62

3 Answers3

3

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

Poul Kruijt
  • 64,681
  • 11
  • 135
  • 134
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
  • 558,509
  • 191
  • 1,911
  • 1,506
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
  • 267
  • 1
  • 6