2

After filling all mandatory field of form submit button is Enable.

When i clear the form all date is clearing but submit button Still Enable.

Here is myForm :

**<form id="payment-form" name="creditPaymentForm">
    <input type="text" ng-model="cardcno" ng-minlength="15" required="">
    <input type="text" ng-model="cardcvv" ng-minlength="3" required="">
    <input type="text" ng-model="cardexp" ng-minlength="6" required="">
    <button type="submit" ng-click="submitForm()" ng-disabled="creditPaymentForm.$invalid">Submit</button>**
    <button type="reset"  ng-click="creditPaymentForm.$setPristine();">Clear</button>
</form>
2
  • remove $scope from ng-click on clear Commented Sep 28, 2016 at 9:05
  • Tried That, Still Coming as Valid. Commented Sep 28, 2016 at 9:11

1 Answer 1

1

Workine fine for me

i have also intialize the values in the controller like this

  $scope.cardcno = "";
  $scope.cardcvv = "";
  $scope.cardexp = "";

Here is a working fiddle:

JSFIDDLE

Sign up to request clarification or add additional context in comments.

1 Comment

You are Right, we should not user ` $scope.creditPaymentForm = {}; `, its making the complete Object Empty

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.