0

I'm stumped by the following problem. I have the following html input using AngularJS:

<input class="form-control" type="number" name="widgetQuantity" id="widgetQuantity"
ng-model="finalWidget.quantity" placeholder="Enter A Number" min="1" 
ng-pattern="/^\d+$/" required/>

<p ng-show="widgetForm.widgetQuantity.$error.min" class="help-block">
You gotta order at least one.</p>

<p ng-show="widgetForm.widgetQuantity.$error.pattern" class="help-block">
No partial widgets, please.</p>

The ng-pattern directive catches the negative symbol and decimals, but it's not catching "e" input into the form. Any thoughts? Thanks!

1
  • uhm i think you should use ngMessages to display and validate your forms Commented Oct 11, 2016 at 3:53

1 Answer 1

2

Removing the type="number" requirement in the input field solved this issue -- apparently HTML validation will override errors from the angular side.

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.