Skip to content

Commit

Permalink
Create case-sensitive.js
Browse files Browse the repository at this point in the history
  • Loading branch information
stanleygu committed Nov 5, 2014
1 parent 172eec7 commit 401b7a9
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions case-sensitive.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
'use strict'

angular.module('sg.case.sensitive')
.directive('caseSensitive', function() {
return {
link: function(scope, element, attr) {
scope.attr = attr;
var caseSensitive = attr.caseSensitive.split(',');
angular.forEach(caseSensitive, function(a) {
var lowercase = a.toLowerCase();
scope.$watch('attr[lowercase]', function() {
element[0].setAttribute(a, element[0].getAttribute(lowercase));
});
});
}
};
});

0 comments on commit 401b7a9

Please sign in to comment.