本文整理汇总了TypeScript中@angular/core.KeyValueChanges.forEachRemovedItem方法的典型用法代码示例。如果您正苦于以下问题:TypeScript KeyValueChanges.forEachRemovedItem方法的具体用法?TypeScript KeyValueChanges.forEachRemovedItem怎么用?TypeScript KeyValueChanges.forEachRemovedItem使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular/core.KeyValueChanges
的用法示例。
在下文中一共展示了KeyValueChanges.forEachRemovedItem方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
this.zone.runOutsideAngular(() => {
changes.forEachChangedItem((c) => {
this.layersControl.removeLayer(c.previousValue);
addFn.call(this.layersControl, c.currentValue, c.key);
results.layersChanged++;
});
changes.forEachRemovedItem((c) => {
this.layersControl.removeLayer(c.previousValue);
results.layersRemoved++;
});
changes.forEachAddedItem((c) => {
addFn.call(this.layersControl, c.currentValue, c.key);
results.layersAdded++;
});
});
示例2: applyChanges
private applyChanges(changes: KeyValueChanges<string, L.Layer>, addFn: (layer: L.Layer, name: string) => void): LeafletControlLayersChanges {
let results: LeafletControlLayersChanges = new LeafletControlLayersChanges();
if (null != changes) {
changes.forEachChangedItem((c) => {
this.layersControl.removeLayer(c.previousValue);
addFn.call(this.layersControl, c.currentValue, c.key);
results.layersChanged++;
});
changes.forEachRemovedItem((c) => {
this.layersControl.removeLayer(c.currentValue);
results.layersRemoved++;
});
changes.forEachAddedItem((c) => {
addFn.call(this.layersControl, c.currentValue, c.key);
results.layersAdded++;
});
}
return results;
}
示例3: _applyChanges
private _applyChanges(changes: KeyValueChanges<string, string|number>): void {
changes.forEachRemovedItem((record) => this._setStyle(record.key, null));
changes.forEachAddedItem((record) => this._setStyle(record.key, record.currentValue));
changes.forEachChangedItem((record) => this._setStyle(record.key, record.currentValue));
}