Created
January 12, 2014 17:03
-
-
Save wishfoundry/8387418 to your computer and use it in GitHub Desktop.
still experimenting with extending directive, this time more globally. This is a bit of a hack really
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
(function(undefined){ | |
var oldDir = angular.module('app').directive; | |
angular.module('app').directive = function(name, dFactory) { | |
var dir = oldDir(name, dFactory); | |
if(dir.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); | |
// node.parentNode.removeChild(node); | |
} | |
})() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment