greenoldman greenoldman - 1 year ago 106
AngularJS Question

How to allow processing invalid input?

I wrote and added custom validator for input data in order to prevent form being submitted (with invalid data). And it seems as a bonus I also got no processing of invalid data -- for example

is not triggered despite the input is changing.

So how to allow processing of the input, and tell Angular to use validators for telling is the form is valid or not only?

Here it is a simple plunker: When the validator returns always
is triggered (see the console). Once you start real validation (in this case, non-empty input is invalid) you won't see

Answer Source

It's the expected behavior, but you can use ngModelOptions directive to make it work as you're expecting.

Just add the following to your input:

ng-model-options="{allowInvalid: true}"

Look at the forked DEMO.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download