W3cubDocs

/Angular

KeyValueDiffers

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

API

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

constructor

KeyValueDiffers
@paramfactoriesKeyValueDifferFactory[]
@returnsKeyValueDiffers

find

KeyValueDifferFactory
@paramkvany

create

KeyValueDiffers
@paramfactoriesKeyValueDifferFactory[]
@paramparentKeyValueDiffers | undefined
@returnsKeyValueDiffers

extend

StaticProvider

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

@paramfactoriesKeyValueDifferFactory[]
@returnsStaticProvider
Usage notes

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 KeyValueDiffer available.

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

Super-powered by Google ©2010–2025.
Code licensed under an MIT-style License. Documentation licensed under CC BY 4.0.
https://angular.dev/api/core/KeyValueDiffers