diff --git a/client/client/src/address-edit/address-edit.html b/client/client/src/address-edit/address-edit.html index c4fbf229a..72c6b4136 100644 --- a/client/client/src/address-edit/address-edit.html +++ b/client/client/src/address-edit/address-edit.html @@ -1,6 +1,6 @@ + { - this.$http.get(`${this.url}/${id}`).then( - json => this.writeData(json, resolve), - json => reject(json) - ); - }); + // return new Promise((resolve, reject) => { + this.$http.get(`${this.url}/${id}`).then( + json => { + this.data = this.copyObject(json.data); + this.copyData(); + } + // json => reject(json) + ); + // }); } /** * Submits the data and goes back in the history. diff --git a/services/client/common/models/address.js b/services/client/common/models/address.js index b72618112..c9bcfb0d8 100644 --- a/services/client/common/models/address.js +++ b/services/client/common/models/address.js @@ -22,6 +22,18 @@ module.exports = function(Address) { getAddress(ctx, data, next); }); + Address.beforeRemote('findById', function(ctx, modelInstance, next) { + ctx.args.filter = { + "include": { + "relation": "province", + "scope": { + "fields": ["id", "name"] + } + } + }; + next(); + }); + function getAddress(ctx, data, next){ var address = Address.findOne( {where: { id: data.id}}, function (err, address){ if(address)