*ngFor how to bind each item in array to ngModel using index

后端 未结 2 698
眼角桃花
眼角桃花 2020-12-29 04:11

===final updated==

http://plnkr.co/edit/WKRBB7?p=preview

since I use ngModel in a form, I must add name attribue.

and my mistake is that

2条回答
  •  情话喂你
    2020-12-29 04:29

    in you case sir if you are using *ngFor for loop then i don't think so you need index. why don't you just use x.Name. here is the modified code.

    {{ i+ 1 }} {{x.Name}}

    or can you try this

    {{ i+ 1 }} {{x.Name}}

提交回复
热议问题