findByCategory:function(category,successCall,errorCall){ HttpService.send({method: 'GET',url: '/workType/category' + category},successCall,errorCall);}
mmsDirectives.directive('categoryValidation', ['WorkTypeService', function(WorkTypeService) { return { require: 'ngModel', link: function(scope, elm, attrs, ctrl) { ctrl.$parsers.unshift(function(viewValue) { if(viewValue) { WorkTypeService.findByCategory(viewValue, function(workTypes) { if(_.isEmpty(workTypes) || workTypes.category== attrs.categoryValidation) { ctrl.$setValidity('category', true); } else { ctrl.$setValidity('category', false); } }); } return viewValue; }); } };}]);
相关分类