本文整理匯總了TypeScript中@angular/core.KeyValueDiffers類的典型用法代碼示例。如果您正苦於以下問題:TypeScript KeyValueDiffers類的具體用法?TypeScript KeyValueDiffers怎麽用?TypeScript KeyValueDiffers使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了KeyValueDiffers類的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: constructor
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>();
}
示例2: constructor
constructor(private dtRef:ChangeDetectorRef, private dtMetaDiffers:KeyValueDiffers) {
this.dtConfig = DT_CONFIG_DEFAULTS;
this.dtMetaDiffer = dtMetaDiffers.find({}).create(dtRef);
}
示例3: constructor
constructor(differs: KeyValueDiffers) {
this.differ = differs.find([]).create(null);
this.onRemove = new EventEmitter();
}
示例4: ngStyle
@Input()
set ngStyle(v: {[key: string]: string}) {
this._ngStyle = v;
if (!this._differ && v) {
this._differ = this._differs.find(v).create(null);
}
}
示例5: ngStyle
@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);
}
}
示例6: ngStyle
@Input()
set ngStyle(values: {[key: string]: string}) {
this._ngStyle = values;
if (!this._differ && values) {
this._differ = this._differs.find(values).create();
}
}
示例7: myUnless
@Input() set myUnless(condition: boolean) {
if (!condition) {
this.viewContainer.createEmbeddedView(this.templateRef);
} else {
this.viewContainer.clear();
}
console.dir(this.differs.find(condition));
}
示例8: ngOnChanges
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();
}
}
}
示例9: ngStyle
@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();
}
}
示例10:
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;
}