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

  • Expert Angular
  • Mathieu Nayrolles Rajesh Gunasundaram Sridhar Rao
  • 51字
  • 2021-07-15 17:05:36

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.

主站蜘蛛池模板: 安化县| 静安区| 武夷山市| 盘锦市| 长葛市| 许昌市| 罗源县| 星子县| 礼泉县| 晋州市| 陆河县| 夏邑县| 故城县| 涞水县| 黄龙县| 孝昌县| 淄博市| 天水市| 遵义县| 乐清市| 奎屯市| 汤阴县| 兰溪市| 台中县| 绥中县| 阿荣旗| 内江市| 石楼县| 淮北市| 靖西县| 罗平县| 达拉特旗| 安丘市| 隆昌县| 昭觉县| 大渡口区| 乐山市| 富顺县| 望城县| 城固县| 乌兰浩特市|