Reputation: 3307
I have a model that has array inside an array of object:
<div *ngFor="let n of shops?.locations let i=index;">
<span>{{n.name}}</span>
<button (click)="select(n, i)">select</button>
</div>
<popup>
<div *ngFor="let subloc of locationssub let j=index;">
<span>{{subloc.id}}</span>
<span><{{subloc.name}}</span>
<button (click)="delete(subloc, j)">del</button>
</div
</popup>
In my component I have:
select(n, i){
this.indexi=i;
this.locationssub=n;
this.popup.show();
}
delete(subloc, j){
this.shops.locations[this.indexi].locationssub.splice(j,1);
}
When I run this, it doesn't splice and remove the row.
How can i fix it?
Upvotes: 0
Views: 82
Reputation: 278
Hello there are two possible reasons for this.
Upvotes: 1