TypeScript @angular-core.KeyValueDiffers类(方法)实例源码

下面列出了TypeScript @angular-core.KeyValueDiffers 类(方法)源码代码实例,从而了解它的用法。

作者:misterona    项目:Verion-1.0-Donation-Dashboar   
constructor(leafletDirective: LeafletDirective, private differs: KeyValueDiffers, private zone: NgZone) {
		this.leafletDirective = new LeafletDirectiveWrapper(leafletDirective);
		this.controlLayers = new LeafletControlLayersWrapper(this.zone);

		// Generate differs
		this.baseLayersDiffer = this.differs.find({}).create<string, Layer>();
		this.overlaysDiffer = this.differs.find({}).create<string, Layer>();

	}

作者:ledge2    项目:ng2-datatabl   
constructor(private dtRef:ChangeDetectorRef, private dtMetaDiffers:KeyValueDiffers) {
   this.dtConfig = DT_CONFIG_DEFAULTS;
   this.dtMetaDiffer = dtMetaDiffers.find({}).create(dtRef);
 }

作者:clankfor    项目:angular2-sandbo   
constructor(differs: KeyValueDiffers) {
     this.differ = differs.find([]).create(null);
     this.onRemove = new EventEmitter();
 }

作者:AlmogShau    项目:angula   
@Input()
 set ngStyle(v: {[key: string]: string}) {
   this._ngStyle = v;
   if (!this._differ && v) {
     this._differ = this._differs.find(v).create(null);
   }
 }

作者:AngularLover    项目:angula   
@Input()
 set ngStyle(v: {[key: string]: string}) {
   this._ngStyle = v;
   if (isBlank(this._differ) && isPresent(v)) {
     this._differ = this._differs.find(this._ngStyle).create(null);
   }
 }

作者:KaneFreema    项目:angula   
@Input()
 set ngStyle(values: {[key: string]: string}) {
   this._ngStyle = values;
   if (!this._differ && values) {
     this._differ = this._differs.find(values).create();
   }
 }

作者:training4developer    项目:ng2pre   
@Input() set myUnless(condition: boolean) {
		if (!condition) {
			this.viewContainer.createEmbeddedView(this.templateRef);
		} else {
			this.viewContainer.clear();
		}

		console.dir(this.differs.find(condition));
	}

作者:bradyhous    项目:hous   
ngOnChanges(changes: any): void {
    console.debug(this.constructor.name + '.ngOnChanges');

    if ('options' in changes) {
      const value = changes['options'].currentValue;
      if (!this._differ && value) {
        this._differ = this._differs.find(value).create();
      }
    }
  }

作者:matsk    项目:angula   
@Input()
 set ngStyle(
     /**
      * A map of style properties, specified as colon-separated
      * key-value pairs.
      * * The key is a style name, with an optional `.<unit>` suffix
      *    (such as 'top.px', 'font-style.em').
      * * The value is an expression to be evaluated.
      */
     values: {[key: string]: string}) {
   this._ngStyle = values;
   if (!this._differ && values) {
     this._differ = this._differs.find(values).create();
   }
 }

作者:DeepanParik    项目:angula   
transform<K, V>(
      input: null|{[key: string]: V, [key: number]: V}|Map<K, V>,
      compareFn: (a: KeyValue<K, V>, b: KeyValue<K, V>) => number = defaultComparator):
      Array<KeyValue<K, V>>|null {
    if (!input || (!(input instanceof Map) && typeof input !== 'object')) {
      return null;
    }

    if (!this.differ) {
      // make a differ for whatever type we've been passed in
      this.differ = this.differs.find(input).create();
    }

    const differChanges: KeyValueChanges<K, V>|null = this.differ.diff(input as any);

    if (differChanges) {
      this.keyValues = [];
      differChanges.forEachItem((r: KeyValueChangeRecord<K, V>) => {
        this.keyValues.push(makeKeyValuePair(r.key, r.currentValue !));
      });
      this.keyValues.sort(compareFn);
    }
    return this.keyValues;
  }


问题


面经


文章

微信
公众号

扫码关注公众号