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

IterableDiffers

NgFor、NgClass 等使用的不同迭代策略的存储库。

A repository of different iterable diffing strategies used by NgFor, NgClass, and others.

      
      class IterableDiffers {
  static create(factories: IterableDifferFactory[], parent?: IterableDiffers): IterableDiffers
  static extend(factories: IterableDifferFactory[]): StaticProvider
  constructor(factories: IterableDifferFactory[])
  factories: IterableDifferFactory[]
  find(iterable: any): IterableDifferFactory
}
    

Provided in

  •       
          'root'
        

静态方法

      
      static create(factories: IterableDifferFactory[], parent?: IterableDiffers): IterableDiffers
    
参数
factories IterableDifferFactory[]
parent IterableDiffers
可选. 默认值是 `undefined`.
返回值

IterableDiffers

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

StaticProvider

使用说明

例子
Example

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

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

属性

属性说明
factories: IterableDifferFactory[]

方法

      
      find(iterable: any): IterableDifferFactory
    
参数
iterable any
返回值

IterableDifferFactory