30秒学会 Angular 片段 – Understanding Microsyntax
Under the hood Angular compiles structural directives into ng-template elements, e.g.:
<!-- This -->
<div *ngFor="let item of [1,2,3]">
<!-- Get expanded into this -->
<ng-template ngFor [ngForOf]="[1,2,3]" let-item="$implicit"></ng-template>
The value passed to *ngFor directive is written using microsyntax. You can learn about it in the docs.
Also check out an interactive tool that shows the expansion by Alexey Zuev
翻译自:https://www.30secondsofcode.org/angular/s/understanding-microsyntax
相关链接
- https://angular.io/guide/structural-directives#microsyntax
- https://alexzuza.github.io/ng-structural-directive-expander/
- https://angular.io/guide/structural-directives#inside-ngfor