* in * ngFor在angle2中的含义是什么?
发布时间:2020-12-17 09:41:47 所属栏目:安全 来源:网络整理
导读:以下样例中的* before ngFor的含义是什么,为什么需要? div *ngFor="#hero of heroes" (click)="selectHero(hero)" {{hero.name}}/div ngFor只能应用于 template. * ngFor是可以应用于任何元素的简短形式, template元素隐含地创建在场景后面. https://angula
以下样例中的* before ngFor的含义是什么,为什么需要?
<div *ngFor="#hero of heroes" (click)="selectHero(hero)"> {{hero.name}} </div>
ngFor只能应用于< template>. * ngFor是可以应用于任何元素的简短形式,< template>元素隐含地创建在场景后面.
https://angular.io/docs/ts/latest/api/common/index/NgFor-directive.html
所有structural directives的模式都是一样的 Plunker example 更新 使用2.0.0最终版本< ng-container>被引入,其行为类似于< template> (实际上并不添加到DOM中的包装元素),但支持* ngFor =“…”语法. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |