mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-16 11:42:04 +08:00
Add an additional notification for propChange event (required for angular2).
This commit is contained in:
@ -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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user