I have custom input as AngularJS 1.5 component with one-way data bindings and ngModel as two-way data binding:
return {
bindings: {
form: "<",
fieldName: "@",
minLength: "@",
maxLength: "@",
isRequired: "@",
errors: "<",
value: "=ngModel"
},
templateUrl: "actTextField.html",
controller: ActTextFieldController,
}
in file actTextField.js in provided Plunk. I want to follow A new Angular 1.x ES2015 styleguide, the path to Angular 2 where Todd wrote:
We no longer should utilise two-way data-binding through '=' syntax for bindings
Use one-way databinding '<' and functions '&'
So, 2-way data binding for ngModel may not be a good choice, it should be 1-way. On the other hand, I want to keep component as simple as possible - without, for example, on-change callback. It should act close to native input with ngModel directive. Is it possible to pass ngModel to component without 2-way data binding and at the same time be able to change its value from a component, to avoid (for example) additional callbacks? Thank you in advance for every answer.