Skip to content

Instantly share code, notes, and snippets.

@wishfoundry
Created January 12, 2014 17:03
Show Gist options
  • Save wishfoundry/8387418 to your computer and use it in GitHub Desktop.
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
(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