Skip to content

Instantly share code, notes, and snippets.

@kruyvanna
Created August 5, 2013 03:08
Show Gist options
  • Save kruyvanna/6153196 to your computer and use it in GitHub Desktop.
Save kruyvanna/6153196 to your computer and use it in GitHub Desktop.
<my-widget>
<p>This is my paragraph text.</p>
</my-widget>
var app = angular.module("MyApp", []);
app.directive("myWidget", function() {
return {
restrict: "E",
transclude: true,
template: "<h3>Heading</h3>"
link: function(scope, element, attrs) {
//How do i get
//<p>This is my paragraph text.</p>
// without the <h3>Heading</h3> ?
// My question is to get the source element inside <my-widget> before it got appended by the template
}
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment