@Component({
Selektor: 'hero-detail',
Vorlage: `
<p *ngIf="hero">
<h2>{{hero.name}} details!</h2>
<p><label>id: </label>{{hero.id}}</p>
<p>
<label>name: </label>
<input [(ngModel)]="hero.name" placeholder="name"/>
</p>
</p>
`
})
Wofür wird der Selektor verwendet?
人生最曼妙的風(fēng)景,竟是內(nèi)心的淡定與從容!
selector
就是template
的容器
這邊selector
是hero-detail
,那么下面的template
會顯示在<hero-detail></hero-detail>
這樣的容器中