Last active
August 29, 2015 14:09
-
-
Save Xanir/b64ff36ce20b5046722a to your computer and use it in GitHub Desktop.
Directive Wrapping
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
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