Cookies concent notice

This site uses cookies from Google to deliver its services and to analyze traffic.
Learn more
Skip to main content
This site is no longer updated.Head to Angular.devHome
/

This is the archived documentation for Angular v17. Please visit angular.dev to see this page for the current version of Angular.

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 }

Provided in

  • 'root'

Static methods

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

Optional. Default is undefined.

Returns

KeyValueDiffers

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.

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

StaticProvider

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()])
  ]
})
    

Constructor

      
      constructor(factories: KeyValueDifferFactory[])
    
Parameters
factories KeyValueDifferFactory[]

Properties

Property Description
factories: KeyValueDifferFactory[]

Deprecated v4.0.0 - Should be private.

Methods

      
      find(kv: any): KeyValueDifferFactory
    
Parameters
kv any
Returns

KeyValueDifferFactory