import ngModule from '../../module'; import Component from 'core/lib/component'; export default class Controller extends Component { removeObservation(index) { this.$.watcher.setDirty(); this.$.model.remove(index); } cancel() { this.goToIndex(); } goToIndex() { this.$state.go('client.card.address.index'); } onResponse(response) { this.address.postalCode = response.code; } onSubmit() { this.$.watcher.submit() .then(() => this.$.model.save(true)) .then(() => { this.card.reload(); this.goToIndex(); }); } onCustomAgentAccept() { return this.$http.post(`CustomsAgents`, this.newCustomsAgent) .then(res => this.address.customsAgentFk = res.data.id); } } ngModule.component('vnClientAddressEdit', { template: require('./index.html'), controller: Controller, require: { card: '^vnClientCard' } });