填写这份《一分钟调查》,帮我们(开发组)做得更好!去填写Home

KeyValueDiffers

NgClass、NgStyle 等使用的不同映射表差异策略的存储库。

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 create<S>(factories: KeyValueDifferFactory[], parent?: KeyValueDiffers): KeyValueDiffers
    
参数
factories KeyValueDifferFactory[]
parent KeyValueDiffers
可选. 默认值是 `undefined`.
返回值

KeyValueDiffers

接受 KeyValueDifferFactory的数组,并返回一个提供者,用于使用提供的工厂扩展所继承的 KeyValueDiffers实例,并返回一个新的 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 KeyValueDifferFactory[]
返回值

StaticProvider

使用说明

例子
Example

以下示例显示如何扩展现有工厂列表,该列表仅适用于该组件及其子组件的注入器。这是使新的KeyValueDiffer可用的全部步骤。

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 KeyValueDifferFactory[]

属性

属性说明
factories: KeyValueDifferFactory[]

方法

      
      find(kv: any): KeyValueDifferFactory
    
参数
kv any
返回值

KeyValueDifferFactory