KeyValueDiffers

A repository of different Map diffing strategies used by NgClass, NgStyle, and others.

class KeyValueDiffers { static create<S>(factories: KeyValueDifferFactory[], parent?: KeyValueDiffers): KeyValueDiffers static extend<S>(factories: KeyValueDifferFactory[]): StaticProvider constructor(factories: KeyValueDifferFactory[]) factories: KeyValueDifferFactory[] find(kv: any): KeyValueDifferFactory }

静态方法

static create<S>(factories: KeyValueDifferFactory[], parent?: KeyValueDiffers): KeyValueDiffers

参数

factories

Type: KeyValueDifferFactory[].

parent

Type: KeyValueDiffers.

可选. 默认值是 undefined.

返回值

KeyValueDiffers

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

static extend<S>(factories: KeyValueDifferFactory[]): StaticProvider

参数

factories

Type: KeyValueDifferFactory[].

返回值

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

@Component({ viewProviders: [ KeyValueDiffers.extend([new ImmutableMapDiffer()]) ] })

构造函数

constructor(factories: KeyValueDifferFactory[])

参数

factories

Type: KeyValueDifferFactory[].

属性

属性名类型说明
factories

方法

find(kv: any): KeyValueDifferFactory

参数

kv

Type: any.

返回值

KeyValueDifferFactory