Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.