import ngModule from '../module'; import Section from 'salix/components/section'; import './style.scss'; class Controller extends Section { constructor($element, $) { super($element, $); let isDirty = false; this.$.$watch('$ctrl.selection', newValue => { if (newValue) { this.$.addressModel.where = {clientFk: newValue.id}; this.$.addressModel.refresh(); if (isDirty) this.order.addressFk = newValue.defaultAddressFk; isDirty = true; } else { this.$.addressModel.clear(); if (isDirty) this.order.addressFk = null; } }); } } ngModule.vnComponent('vnOrderBasicData', { controller: Controller, template: require('./index.html'), bindings: { order: '<' } });