Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AngularJS override ng-model-options updateOn submit

Tags:

angularjs

I have an input field which will update the corresponding model when the form is submitted using ng-model-options="{updateOn: 'submit'}"

However, I have occasions where I need to update the model before submission. Is there a way to override this delay and force a model to update without having to programatically submit the form?


1 Answers

$commitViewValue() sorts this out:

$scope.myForm.myFieldName.$commitViewValue();