Skip to content

Instantly share code, notes, and snippets.

@lukegb
Created December 30, 2015 16:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lukegb/27e46a2049c430e28f43 to your computer and use it in GitHub Desktop.
Save lukegb/27e46a2049c430e28f43 to your computer and use it in GitHub Desktop.
app.directive('loginField', function($timeout) {
return {
require: 'ngModel',
link: function(scope, elem, attrs, ctrl) {
ctrl.$validators.loginform = function(modelValue, viewValue) {
return true;
};
$timeout(function() {
ctrl.$setTouched();
ctrl.$validate();
ctrl.$setValidity('loginform', LOGIN_ERRORS.length === 0);
}, 100);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment