- 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.
推薦閱讀
- 軟件項(xiàng)目管理(第2版)
- Java開發(fā)入行真功夫
- Python高級(jí)機(jī)器學(xué)習(xí)
- 深入淺出Android Jetpack
- Working with Odoo
- 微信小程序開發(fā)與實(shí)戰(zhàn)(微課版)
- Python:Deeper Insights into Machine Learning
- Cocos2d-x by Example:Beginner's Guide(Second Edition)
- Unity 2017 Game AI Programming(Third Edition)
- Instant GLEW
- 你好!Java
- Java程序設(shè)計(jì)及應(yīng)用開發(fā)
- Build Your Own PaaS with Docker
- Real-time Analytics with Storm and Cassandra
- LabVIEW案例實(shí)戰(zhàn)