Angular Form Validation – min element can’t be greater than max element

I have some simply validation in my range inputs like this:

    <form name="form" novalidate>
    Min: <input type="number" name="min" ng-model="rangemin" ng-pattern="/^[0-9]+$/">
    Max: <input type="number" name="max" ng-model="rangemax" ng-pattern="/^[0-9]+$/">
    </form>

I added the classes ng-valid(green) and ng-invalid(red) in my CSS so that it gets painted corectly and the input gets saved in ng-model variable. And that works fine, but I want to put on some extra validation. If min is greater then max or max is lower than min then the input shouldn’t be valid. How can i achieve this? I’m new to Angular, I can make directives, controllers etc. but I dont know how to validate both inputs and set the invalid state on them.


Download angular.form.validation.min.element.cant.be.greater.than.max.element.zip
Direct Link


Download


Download angular.form.validation.min.element.cant.be.greater.than.max.element.zip
Mediafire


Download


Download angular.form.validation.min.element.cant.be.greater.than.max.element.zip
RapidShare


Download

Both comments and pings are currently closed.

Comments are closed.