Skip to content

Instantly share code, notes, and snippets.

@cpoDesign
Created June 11, 2014 09:36
Show Gist options
  • Select an option

  • Save cpoDesign/e37c78a8e5f4da71b45b to your computer and use it in GitHub Desktop.

Select an option

Save cpoDesign/e37c78a8e5f4da71b45b to your computer and use it in GitHub Desktop.
Example of creating directive that adds html to start and end of template
// use example: <my-button>
testApp.directive('myButton', function(){
return {
link: function (scope, element, attrs) {
var markup = "<button>Hello</button>";
element.prepend(markup); // adds html before any child
element.append(markup); // adds html after last child
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment