Trying to update array object value but not working. I am trying to update item value from an array But not updating. How to resolve this issue.
ngOnInit() {
this.arr = [
{
lable: 'test1',
item: 'Row6',
},
{
lable: 'test2',
item: 'Row9',
},
{
lable: 'test3',
item: 'Row4',
},
];
}
updateVal() {
this.arr = this.arr[0].item = 'Row9';
console.log(this.arr);
}
Demo: https://stackblitz.com/edit/angular-ivy-srsirm?file=src%2Fapp%2Farrcom%2Farrcom.component.ts
Via Active questions tagged javascript - Stack Overflow https://ift.tt/ADiX0Ms
Comments
Post a Comment