How to pass variable to “data-target=” angular 2

前端 未结 3 1157
天涯浪人
天涯浪人 2021-02-01 01:34

I\'m working with angular 2 typescript and i want to create a toggle collapse list. This is simple with single id and data-target but i loop throught a list so i ha

3条回答
  •  清酒与你
    2021-02-01 02:28

    Yes exactly you can use

    *ngFor="a of Array; index as i;"
    

    and

    [attr.data-target]="'#test' + i"
    

    and

    name="test{{i}}
    

提交回复
热议问题