This is the archived documentation for Angular v6. Please visit angular.io to see documentation for the current version of Angular.

IterableDiffers

A repository of different iterable diffing strategies used by NgFor, NgClass, and others.

      
      class IterableDiffers {
  static ngInjectableDef: defineInjectable({...})
  static create(factories: IterableDifferFactory[], parent?: IterableDiffers): IterableDiffers
  static extend(factories: IterableDifferFactory[]): StaticProvider
  constructor(factories: IterableDifferFactory[])
  factories: IterableDifferFactory[]
  find(iterable: any): IterableDifferFactory
}
    

Static properties

Property Description
static ngInjectableDef: defineInjectable({ providedIn: 'root', factory: () => new IterableDiffers([new DefaultIterableDifferFactory()]) })

Static methods

static create(factories: IterableDifferFactory[], parent?: IterableDiffers): IterableDiffers
      
      static create(factories: IterableDifferFactory[], parent?: IterableDiffers): IterableDiffers
    

Parameters

factories

Type: IterableDifferFactory[].

parent

Type: IterableDiffers.

Optional. Default is undefined.

Returns

IterableDiffers

Takes an array of IterableDifferFactory and returns a provider used to extend the inherited IterableDiffers instance with the provided factories and return a new IterableDiffers instance.

static extend(factories: IterableDifferFactory[]): StaticProvider
      
      static extend(factories: IterableDifferFactory[]): StaticProvider
    

Parameters

factories

Type: IterableDifferFactory[].

Returns

StaticProvider

Example

The following example shows how to extend an existing list of factories, which will only be applied to the injector for this component and its children. This step is all that's required to make a new IterableDiffer available.

@Component({ viewProviders: [ IterableDiffers.extend([new ImmutableListDiffer()]) ] })
      
      @Component({
  viewProviders: [
    IterableDiffers.extend([new ImmutableListDiffer()])
  ]
})
    

Constructor

constructor(factories: IterableDifferFactory[])
      
      constructor(factories: IterableDifferFactory[])
    

Parameters

factories

Type: IterableDifferFactory[].

Properties

Property Description
factories: IterableDifferFactory[]

Methods

find(iterable: any): IterableDifferFactory
      
      find(iterable: any): IterableDifferFactory
    

Parameters

iterable

Type: any.

Returns

IterableDifferFactory