@Component({
selector: 'hero-detail',
template: `
<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>
`
})
What is the selector used for?
selector
is the containerof
templateThe
selector
here ishero-detail
, then the followingtemplate
will be displayed in a container like<hero-detail></hero-detail>