Hi,
When you are making entry in text box , you are making changes to model.
1. ng-change gets activated and performs addNewOpt function gets executed.
2. when mouse is clicked outside text box , form field input text box gets
blurred and updateOn will get activated and your updates will happen.
Coming to your question,
use ng-keyup="cancel($event)' if you want to cancel updates or other events.
or you can even use keypress events instead of blur for immediate updates
On Friday, 6 November 2015 15:51:07 UTC+5:30, Mn Kishore wrote:
>
> I have the following input box with ng-options :
>
>
> <input ng-model="name" ng-model-options="{ updateOn: 'blur'}"
> ng-change="addNewDpt()" type="text">
>
> $scope.addNewDpt = function(){
> // code
> }
>
> If I make some entry in the text box and click the mouse somewhere outside
> the input text box then function addNewDpt is getting executed and also
> the model name is getting update properly, which is fine. Now I want the
> same to happen, if I click enter or tab keys in the text box. How can I
> achieve it?
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.