Angular 4: setting the local variable # dynamically

后端 未结 3 1363
情书的邮戳
情书的邮戳 2020-12-09 11:24

Is there a way to dynamically set the #id, the HTML attribute that angular uses to construct the @ViewChild element reference?

Specific need: i have the following te

3条回答
  •  误落风尘
    2020-12-09 12:16

    Despite the seeming resemblance between regular variables and #, multiple elements can be assigned to single local template reference variable:

    Which can be obtained with:

    @ViewChildren('linkRef') linkRefs;
    

提交回复
热议问题