Skip to content

Instantly share code, notes, and snippets.

@karl-gustav
Created October 22, 2014 12:06
Show Gist options
  • Save karl-gustav/bacb83dbc30705a2e98f to your computer and use it in GitHub Desktop.
Save karl-gustav/bacb83dbc30705a2e98f to your computer and use it in GitHub Desktop.
[] template
app.directive("myDirective", function(){
return {
restrict: "EA",
scope: {
name: "@",
color: "=",
reverse: "&"
},
template: [
"<div class='line'>",
"Name : <strong>{{name}}</strong>; Change name:<input type='text' ng-model='name' /><br/>",
"</div><div class='line'>",
"Color : <strong style='color:{{color}}'>{{color|uppercase}}</strong>; Change color:<input type='text' ng-model='color' /><br/></div>",
"<br/><input type='button' ng-click='reverse()' value='Reverse Name'/>"
].join("")
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment