Within this Video Phil speaks about ng-model with native getters and setters.
When using Angular it is best to use fat models, thin controllers, put our business logic in factories and prefer functions over properties. However ng-model can only bind to properties, so we find we do need to expose properties. Fortunately JavaScript allows us to define native getter and setter methods which are called implicitly when we get or set properties. This allows us to apply constraints to values in the model rather than in the digest cycle.
Note Angular 1.3 adds the concept of binding ng-model to custom getter/setters which you can use in place of the native getter/setters described above.
http://plnkr.co/edit/aqV3DTAJNATPimA7hq0s?p=preview
ng-model with native getters and setters
https://docs.angularjs.org/api/ng/directive/ngModel#binding-to-a-getter-setter
Phil Holden
Tags: angular
October 10th 2014