netceteragroup / valdr

A model centric approach to AngularJS form validation
http://netceteragroup.github.io/valdr/
MIT License
153 stars 43 forks source link

digits validation doesn't work for input='number' in FF #100

Open rafalskyi opened 8 years ago

rafalskyi commented 8 years ago

in FF in input='number' angular validation fired first when enter letters and i am getting empty message. temp solution

angular.module(app_name).factory('numberOnlyValidator',  function () {
  return {
    name: 'numberOnly', // this is the validator name that can be referenced from the constraints JSON
    validate: function (value) {
      // value: the value to validate
      // arguments: the validator arguments
      return /^[1-9]\d*(\.\d+)?$/.test(value);
    }
  };
});