import ngModule from '../module'; import './style.scss'; class Controller { constructor($scope) { let isDirty = false; $scope.$watch('$ctrl.selection', newValue => { if (newValue) { $scope.addressModel.where = {clientFk: newValue.id}; $scope.addressModel.refresh(); if (isDirty) this.order.addressFk = newValue.defaultAddressFk; isDirty = true; } else { $scope.addressModel.clear(); if (isDirty) this.order.addressFk = null; } }); } } Controller.$inject = ['$scope']; ngModule.component('vnOrderBasicData', { controller: Controller, template: require('./index.html'), bindings: { order: '<' } });