mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
Creating observables from a nested json.
This commit is contained in:
@@ -56,6 +56,9 @@ export class Observable implements definition.Observable {
|
||||
this._map = new Map<string, Object>();
|
||||
for (var prop in json) {
|
||||
if (json.hasOwnProperty(prop)) {
|
||||
if (!Array.isArray(json[prop]) && typeof json[prop] === 'object') {
|
||||
json[prop] = new Observable(json[prop]);
|
||||
}
|
||||
this._defineNewProperty(prop);
|
||||
this.set(prop, json[prop]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user