bendrucker/angular-credit-cards

NgModel value is not updated

jth0024 opened this issue · 1 comments

I'm looking at the example from your documentation, and the ngModel value is not updated until a valid credit card number has been entered. I tested with {{card.number}} in the template. Is this by design? If so, can you update the documentation? Personally, I don't think this behavior is very intuitive. For instance, I was trying to do some secondary validation using ngModelCtrl, but I can't access the value because updates are blocked by your directives.

https://docs.angularjs.org/api/ng/type/ngModel.NgModelController#$validate

Runs each of the registered validators (first synchronous validators and then asynchronous validators). If the validity changes to invalid, the model will be set to undefined, unless ngModelOptions.allowInvalid is true.

Since this is standard Angular behavior I don't think documenting it here is necessary.