Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

setPristine for a single input field

Tags:

angularjs

I'm trying to use setPristine method for a single input field in my form. There are ways to do this for the entire form but i want to do this only to one input field in my form.How can i do this?

I tried it this way

$scope.merchantDetails.customer_id.$setPristine = true;

But did not work.

This is the input field i want to set it to pristine state on some function.

<input class="form-control" id="id_customer_id" name="customer_id" placeholder="Auto-generated if empty" title="" type="text" maxlength="8" ng-keydown="check();" ng-model="customer.customerId">
like image 372
Alpha Dog Avatar asked Sep 22 '16 04:09

Alpha Dog


1 Answers

Probably you can try this.

$scope.form.customer_id.$setPristine(false);

Have a look into this plunker.It might work for u.

like image 53
Umakanta Behera Avatar answered Sep 24 '22 10:09

Umakanta Behera