Skip to content
Snippets Groups Projects
Commit 910d7850 authored by Benoit Lavenier's avatar Benoit Lavenier
Browse files

[fix] Fix geoPoint validator

parent 94e5ca36
No related branches found
No related tags found
No related merge requests found
...@@ -102,7 +102,11 @@ angular.module('cesium.directives', []) ...@@ -102,7 +102,11 @@ angular.module('cesium.directives', [])
link: function(scope, element, attributes, ngModel) { link: function(scope, element, attributes, ngModel) {
if (ngModel) { if (ngModel) {
ngModel.$validators.geoPoint = function(value) { ngModel.$validators.geoPoint = function(value) {
return ngModel.$isEmpty(value) || (angular.isDefined(value.lat) && angular.isDefined(value.lon)); return ngModel.$isEmpty(value) ||
// twice are defined
(angular.isDefined(value.lat) && angular.isDefined(value.lon)) ||
// or twice are NOT defined (=empty object - can be useful to override data in ES node)
(angular.isUndefined(value.lat) && angular.isUndefined(value.lon));
}; };
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment