Angular 2:从ElementRef查询自定义属性值

时间:2018-03-13 19:01:52

标签: angular

我有一张图片列表。我为每个人绑定了一个自定义ID属性:

<img #myChildren ... [attr.myId]="item.id" />

在我的组件中,使用@ViewChildren查询图像:

@ViewChildren( 'myChildren' ) myChildren: QueryList<ElementRef>

给定myChildren的ElementRef,我怎样才能学习myId属性的值?

0 个答案:

没有答案