forEachRemovedItem invokes a callback for every object removed from an iterable collection. An Angular structural directive can use it to remove the embedded view representing each deleted object. section 15.3.4
Handling a removed item requires coordinated view and context updates:
- Find the removed item’s PaIteratorContext in a Map indexed by IterableChangeRecord.trackById. section 15.3.4
- Pass its ViewRef to ViewContainerRef.remove so the corresponding rendered content disappears. section 15.3.4
- Update surviving contexts with their new positions and the total number of active views. section 15.3.4
Deleting a product row
A table’s Delete button calls deleteProduct(item.id). The data model removes the product, the iterable differ reports it through forEachRemovedItem, and the directive removes the matching row. Updating surviving contexts keeps row striping and Delete-button targets correct. section 15.3.4
