IterableDiffer compares an iterable with its previous state during ngDoCheck and returns IterableChanges when items are added, removed, moved, or otherwise changed; it returns null when no work is needed. section 15.3.4
A typical directive creates and consumes the differ as follows:
- Inject IterableDiffers and create a differ from the initial data source with find(...).create(). section 15.3.4
- Call diff(dataSource) in ngDoCheck and skip DOM work when the result is null. section 15.3.4
Incremental updates in a custom iterator
A paFor directive uses IterableDiffer to add embedded views only for newly detected products, then extends the implementation to remove views when products are deleted.
