Angular2 ngModel against ngFor variables

后端 未结 2 1948
迷失自我
迷失自我 2020-12-30 02:22

Is it not possible (or not yet possible) to use ngModel against values from ngFor? Is Angular trying to protect me from bad performance?

W

2条回答
  •  滥情空心
    2020-12-30 02:56

    I think ngFor don't like tracking array elements which are primitive values having ngModel on them.

    If you remove the ngModel inside the loop, it works.

    It works too when I update jsfiddle with :

    this.names = [{name: 'John'}, {name: 'Joe'}, {name: 'Jeff'}, {name: 'Jorge'}];
    

    and

  • {{n.name}}
提交回复
热议问题