Created
January 12, 2014 16:56
-
-
Save wishfoundry/8387308 to your computer and use it in GitHub Desktop.
experimenting with ways to decorate angular directives. The disadvantage here is you apply this to all directives
This file contains hidden or 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
app.config(function($provide) { | |
$provide.decorator('fooDirective', function($delegate) { | |
var directive = $delegate[0]; | |
if(directive.restrict.indexOf('E') >= 0) { | |
makeElement(toDashCase(name)) | |
} | |
function toDashCase(str) { | |
return (str.charAt(0) + string.slice(1).replace(/([A-Z])/g, "-$&")).toLowerCase() | |
} | |
function makeElement(name) { // enable custom elements hack for IE | |
var node = document.createElement(name); | |
} | |
return $delegate; | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment