Angular 2 why asterisk (*)

前端 未结 5 1616
谎友^
谎友^ 2020-12-02 11:52

In angular 2 document, * and template, we know that the *ngIf, *ngSwitch, *ngFor can be expanded to ng-template tag. My question is:

I think the ngIf or

5条回答
  •  独厮守ぢ
    2020-12-02 12:13

    From Angular docs:

    Structural directives are responsible for HTML layout. They shape or reshape the DOM's structure, typically by adding, removing, or manipulating elements.

    As with other directives, you apply a structural directive to a host element. The directive then does whatever it's supposed to do with that host element and its descendants.

    Structural directives are easy to recognize. An asterisk (*) precedes the directive attribute name as in this example.

    {{username}}

提交回复
热议问题