Alpha Dog
Alpha Dog

Reputation: 193

setPristine for a single input field

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">

Upvotes: 8

Views: 4368

Answers (1)

Umakanta Behera
Umakanta Behera

Reputation: 265

Probably you can try this.

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

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

Upvotes: 4

Related Questions