Hi I have object like this
var obj= {
_id: string;
name: string;
loc: [{
locname: string;
locId: string;
locadd: [{
st: string;
zip: string;
}]
}]
}
Using typescript in angular 2 I want to delete a particular row
deleterow(i, j) {
// i is index of loc
// j is index of locadd
this.obj.loc.splice(i, 1) //works fine
this.obj.loc[i].locadd.splice(j, 1) //doesn't work. I don't get any error just
// row is not removed.
}
I am trying solution similar to given in this answer but doesn't work
JavaScript remove item from nested Array
Please let me know how I can remove the an item from locadd Thanks
j?"locadd"property has a single value.splice(0, 1). Given the value of"locadd"at the object at the question any value greater than0passed to first parameter of.slice()will not match any index within the array."locadd"contain more than one element?