官术网_书友最值得收藏!

Local variables in templates

Let us see the example of using local variables in ng-repeat and ngFor in AngularJS and Angular, respectively.

AngularJS:

<tr ng-repeat="book in vm.books"> 
  <td>{{book.name}}</td> 
</tr> 

Angular:

<tr *ngFor="let book of books"> 
  <td>{{book.name}}</td> 
</tr> 

Notice that the local variable book is implicitly declared in AngularJS and in Angular the let keyword is used to define the local variable book.

主站蜘蛛池模板: 刚察县| 东方市| 正镶白旗| 天津市| 陇川县| 布尔津县| 吉安市| 鄯善县| 大邑县| 沁阳市| 农安县| 江门市| 禄丰县| 墨玉县| 清涧县| 留坝县| 华宁县| 屯昌县| 龙岩市| 河北省| 商南县| 昭苏县| 潜山县| 龙岩市| 铜陵市| 定兴县| 萝北县| 呈贡县| 澄江县| 湖南省| 江安县| 札达县| 治多县| 张家界市| 长兴县| 屯门区| 深圳市| 肇源县| 鹤庆县| 绥棱县| 鹤庆县|