Reputation: 1411
I have component (main-cmp
) with rows from database.
For rows I create another component for eg. row-cmp
main-cmp
have requested data from database, and parse it as
<row-cmp *ngFor="let row of data"
[id]="row.id"
[name]="row.name"
[value]="row.value">
</row-cmp>
In row-cmp
I have declare delete()
function who call http request to my backend. Now when response from request is true I want to destroy row-cmp
for selected row. Is this possible ?
Upvotes: 7
Views: 3743
Reputation: 657058
This is not supported. I'd suggest to add an eventemitter
@Output() delete:EventEmitter = new EventEmitter();
and then add an event handler that removes the item from the data array
<row-cmp *ngFor="let row of data;let i=index" (delete)="data.splice(i,1)"
[id]="row.id"
[name]="row.name"
[value]="row.value">
</row-cmp>
Upvotes: 9