本文整理汇总了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;
}