liveBook · Manning

IterableDifferFactory

As explained in Pro Angular 16

IterableDifferFactory is an Angular API class that creates an iterable differ for a supported collection.

IterableDifferFactory creates an IterableDiffer for a collection supported by Angular's iterable-differ system. IterableDiffers.find selects the factory; its create method produces the differ used for comparisons. section 15.3.4

Create a differ for a directive data source

A structural directive can initialize its differ with `this.differs.find(this.dataSource).create()`, then call `differ.diff(this.dataSource)` during `ngDoCheck`. A null result means no collection changes require DOM work. section 15.3.4

How Pro Angular 16 covers it

How deep it goes
Defines factory lookup and creation, while deferring change processing to IterableDiffer and IterableChanges.
Examples
Uses a paFor structural directive to initialize a differ for products and process additions, removals, and moves.
What it assumes
Assumes familiarity with Angular structural directives, dependency injection, and lifecycle hooks such as ngOnInit and ngDoCheck.
What you can do after
Apply it via Angular's IterableDiffers API to create a differ for a supported iterable collection.
How it connects
Connects IterableDiffers, IterableDiffer, IterableChanges, ngDoCheck, and structural directives.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Pro Angular 16. The section links point to the parts of the book it draws on.