- 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.
推薦閱讀
- 深入核心的敏捷開發:ThoughtWorks五大關鍵實踐
- Visual C++程序設計教程
- ExtGWT Rich Internet Application Cookbook
- Visual Basic程序開發(學習筆記)
- Interactive Data Visualization with Python
- 算法基礎:打開程序設計之門
- 機械工程師Python編程:入門、實戰與進階
- Flux Architecture
- 精通Python自然語言處理
- Angular開發入門與實戰
- 用戶體驗可視化指南
- Mastering Git
- Visual C++程序設計與項目實踐
- 精通Spring:Java Web開發與Spring Boot高級功能
- Apache Kafka 1.0 Cookbook