Skip to content

Instantly share code, notes, and snippets.

@Xanir
Last active August 29, 2015 14:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Xanir/b64ff36ce20b5046722a to your computer and use it in GitHub Desktop.
Save Xanir/b64ff36ce20b5046722a to your computer and use it in GitHub Desktop.
Directive Wrapping
module.directive("wrapper", function( $compile ) {
var priority = 123456;
return {
restrict: "A",
terminal: true,
priority: priority,
compile: function( $element, $attrs ) {
var directiveName = this.name;
var htmlDirectiveName = $attrs.$attr[directiveName];
$element.removeAttr(htmlDirectiveName);
$element.attr('wrapped-directive', '');
var sublink = $compile( $element, null, priority );
return {
pre: function ( $scope, element, attributes ) {
sublink( $scope );
},
post: function ( $scope, element, attributes ) {
}
}
}
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment