- <div id="test" ></div> --test是字符串
- <div *ngFor="let item of collection;let index=index;" id="{{'test' + index}}" > </div> --index是变量
- <div *ngFor="let item of collection;let index=index;" [id]=" 'test' + index " > </div> --index是变量
- <div *ngFor="let item of collection;let index=index;" [attr.id]=" 'test' + index " > </div> --index是变量
angular 设置属性的几种方式
最新推荐文章于 2022-05-19 07:24:13 发布