Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Angular 2 ng-model-options="{updateOn: 'change blur'}"

I am using angular 2, I want to change ngModel after Enter press, in angular 1.X we can use ng-model-options="{updateOn: 'change blur'}", but in angular 2 how can we do?

angular 1.x

<input class="form-control value-max" type="text" ng-model="$ctrl.filterData.price_max" ng-model-options="{updateOn: 'change blur'}">
like image 544
Dinesh Kumar Avatar asked Mar 09 '23 19:03

Dinesh Kumar


1 Answers

As of Angular 5 it is possible! You can write in your template:

<input [(ngModel)]="firstName" [ngModelOptions]="{updateOn: 'blur'}">

for more see: https://next.angular.io/api/forms/NgModel#options

like image 96
Elad Douenias Avatar answered Mar 19 '23 17:03

Elad Douenias