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 }

静态属性

属性名类型说明
ngInjectableDef

静态方法

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

参数

factories

Type: IterableDifferFactory[].

parent

Type: IterableDiffers.

可选. 默认值是 undefined.

返回值

IterableDiffers

Takes an array of IterableDifferFactoryand returns a provider used to extend the inherited IterableDiffersinstance with the provided factories and return a new IterableDiffersinstance.

static extend(factories: IterableDifferFactory[]): StaticProvider

参数

factories

Type: IterableDifferFactory[].

返回值

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 IterableDifferavailable.

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

构造函数

constructor(factories: IterableDifferFactory[])

参数

factories

Type: IterableDifferFactory[].

属性

属性名类型说明
factories

方法

find(iterable: any): IterableDifferFactory

参数

iterable

Type: any.

返回值

IterableDifferFactory