mirror of
https://github.com/ansible/awx.git
synced 2026-03-13 15:09:32 -02:30
Improved ngmin/ngmax
the ngmin/ngmax directives were failing out if the user never set the ngmin/ngmax (which could happen). added a check to for empty ngmin's/ngmax's
This commit is contained in:
@@ -151,7 +151,7 @@ angular.module('AWDirectives', ['RestServices', 'Utilities', 'AuthService', 'Job
|
||||
link: function (scope, elem, attr, ctrl) {
|
||||
ctrl.$parsers.unshift( function(viewValue) {
|
||||
var min = (attr.ngMin) ? scope.$eval(attr.ngMin) : -Infinity;
|
||||
if (!Empty(viewValue) && Number(viewValue) < min) {
|
||||
if (!Empty(min) && !Empty(viewValue) && Number(viewValue) < min) {
|
||||
ctrl.$setValidity('ngMin', false);
|
||||
return undefined;
|
||||
} else {
|
||||
@@ -170,7 +170,7 @@ angular.module('AWDirectives', ['RestServices', 'Utilities', 'AuthService', 'Job
|
||||
link: function (scope, elem, attr, ctrl) {
|
||||
ctrl.$parsers.unshift( function(viewValue) {
|
||||
var max = (attr.ngMax) ? scope.$eval(attr.ngMax) : Infinity;
|
||||
if (!Empty(viewValue) && Number(viewValue) > max) {
|
||||
if (!Empty(max) && !Empty(viewValue) && Number(viewValue) > max) {
|
||||
ctrl.$setValidity('ngMax', false);
|
||||
return undefined;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user