我有角度控制器,它注入一个数组:
class a{
constructor(items){
this.items = items;
this.items[0].name = "abc";
}
edit(){
this.items[0].name = "abc";
})
}
如果我要更改此数组中一项的值,在构造函数内部,它将更改原始数组中该项的值。
如果我更改编辑方法中的值,它现在不会更改为原始值。
我能做些什么?
谢谢。