Add an additional notification for propChange event (required for angular2).

This commit is contained in:
Nedyalko Nikolov
2016-01-19 11:06:58 +02:00
parent 97738bd45e
commit b43f5a3be5

View File

@ -364,6 +364,17 @@ export class DependencyObservable extends observable.Observable {
var changeData = super._createPropertyChangeData(property.name, newValue); var changeData = super._createPropertyChangeData(property.name, newValue);
this.notify(changeData); this.notify(changeData);
} }
let eventName = property.name + "Change";
if (this.hasListeners(eventName)) {
var ngChangedData = {
eventName: eventName,
propertyName: property.name,
object: this,
value: newValue
}
this.notify(ngChangedData);
}
} }
public _eachSetProperty(callback: (property: Property) => boolean) { public _eachSetProperty(callback: (property: Property) => boolean) {
@ -388,7 +399,7 @@ export class DependencyObservable extends observable.Observable {
} }
private _setValueInternal(property: Property, value: any, source: number) { private _setValueInternal(property: Property, value: any, source: number) {
// Convert the value to the real property type in case it is coming as a string from CSS or XML. // Convert the value to the real property type in case it is coming as a string from CSS or XML.
if (types.isString(value) && property.valueConverter) { if (types.isString(value) && property.valueConverter) {
value = property.valueConverter(value); value = property.valueConverter(value);
@ -426,4 +437,4 @@ export class DependencyObservable extends observable.Observable {
private _defaultComparer(x: any, y: any): boolean { private _defaultComparer(x: any, y: any): boolean {
return x === y; return x === y;
} }
} }