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

  • 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.

主站蜘蛛池模板: 博乐市| 诸城市| 汉寿县| 兴业县| 乌拉特后旗| 鄱阳县| 杨浦区| 新龙县| 甘孜县| 出国| 义乌市| 瑞丽市| 临城县| 廊坊市| 怀化市| 华池县| 东乡| 林甸县| 东乡县| 玉林市| 东乌| 高阳县| 清镇市| 仲巴县| 澳门| 盐源县| 曲阜市| 和硕县| 尚志市| 谷城县| 安宁市| 砚山县| 方城县| 闽侯县| 峡江县| 齐河县| 古田县| 东宁县| 安康市| 丰都县| 罗田县|