New in Angular 1.3: ng-model-options getters and setters

InstructorKent C. Dodds

Share this video with your friends

Send Tweet

With ngModelOptions in Angular 1.3 you can turn your model into a getter/setter function to have greater control over your model.

Derek
~ 10 years ago

In order to use getterSetter I found myself using arguments.length to allow users to clear values. I've also got updateOn: 'blur' in my model options in my use case.

vm.inputValue = function(val) {
    return arguments.length ? (_val = val) : _val;
  }