Created
July 20, 2016 00:38
-
-
Save stevenirby/649b3e17cd511e3c69815c892390f553 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
'use strict'; | |
angular | |
.module('core') | |
.directive('valdrAccessibility', valdrAccessibility); | |
/* @ngInject */ | |
function valdrAccessibility($timeout) { | |
var directive = { | |
restrict: 'A', | |
controller: valdrAccessibilityController, | |
controllerAs: 'vm', | |
bindToController:true, | |
link: function(scope, elem, attrs, ctrl) { | |
var $prev = elem.prev(); | |
$prev.on('blur', sayError); | |
$prev.on('change', sayError); | |
function sayError() { | |
if (elem.hasClass('ng-invalid')) { | |
$('#accessibility-alert').text(elem.text()); | |
} | |
} | |
} | |
}; | |
return directive; | |
} | |
/* @ngInject */ | |
function valdrAccessibilityController() {} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment