import ngModule from '../../module'; export default class Controller { constructor($scope, $state) { this.$scope = $scope; this.$state = $state; this.data = { address: { clientFk: parseInt($state.params.id), isActive: true }, isDefaultAddress: false }; this.address = this.data.address; } onSubmit() { this.$scope.watcher.submit().then(res => { if (res.data && this.data.isDefaultAddress) this.client.defaultAddressFk = res.data.id; this.$state.go('client.card.address.index'); }); } } Controller.$inject = ['$scope', '$state']; ngModule.component('vnClientAddressCreate', { template: require('./index.html'), controller: Controller, bindings: { client: '<' } });