mirror of
https://github.com/ansible/awx.git
synced 2026-05-11 03:17:38 -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) {
|
link: function (scope, elem, attr, ctrl) {
|
||||||
ctrl.$parsers.unshift( function(viewValue) {
|
ctrl.$parsers.unshift( function(viewValue) {
|
||||||
var min = (attr.ngMin) ? scope.$eval(attr.ngMin) : -Infinity;
|
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);
|
ctrl.$setValidity('ngMin', false);
|
||||||
return undefined;
|
return undefined;
|
||||||
} else {
|
} else {
|
||||||
@@ -170,7 +170,7 @@ angular.module('AWDirectives', ['RestServices', 'Utilities', 'AuthService', 'Job
|
|||||||
link: function (scope, elem, attr, ctrl) {
|
link: function (scope, elem, attr, ctrl) {
|
||||||
ctrl.$parsers.unshift( function(viewValue) {
|
ctrl.$parsers.unshift( function(viewValue) {
|
||||||
var max = (attr.ngMax) ? scope.$eval(attr.ngMax) : Infinity;
|
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);
|
ctrl.$setValidity('ngMax', false);
|
||||||
return undefined;
|
return undefined;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user