Integer Directive was returning false for a blank string

this was causing the integer directive to throw an error if the user entered something in the field, then erased it.
This commit is contained in:
Jared Tabor 2015-10-25 14:43:22 -07:00
parent 8e4adfb887
commit e18791a657

View File

@ -275,7 +275,7 @@ angular.module('AWDirectives', ['RestServices', 'Utilities', 'JobsHelper'])
if (/^\-?\d*$/.test(viewValue)) {
// it is valid
ctrl.$setValidity('integer', true);
if ( viewValue === '-' || viewValue === '-0' || viewValue === '' || viewValue === null) {
if ( viewValue === '-' || viewValue === '-0' || viewValue === null) {
ctrl.$setValidity('integer', false);
return viewValue;
}