search

Home  >  Q&A  >  body text

angular.js - What is the selector in the angularjs 4 component used for?

@Component({
selector: 'hero-detail',
template: `
<p *ngIf="hero">

1

2

3

4

5

6

<code>    <h2>{{hero.name}} details!</h2>

    <p><label>id: </label>{{hero.id}}</p>

    <p>

      <label>name: </label>

      <input [(ngModel)]="hero.name" placeholder="name"/>

    </p></code>

</p>
`
})
What is the selector used for?

黄舟黄舟2823 days ago928

reply all(1)I'll reply

  • typecho

    typecho2017-06-13 09:24:51

    selector is the container of template

    The selector here is hero-detail, then the following template will be displayed in a container like <hero-detail></hero-detail>

    reply
    0
  • Cancelreply