Skip to content

Instantly share code, notes, and snippets.

@vojtajina
Created June 8, 2011 15:50
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vojtajina/1014686 to your computer and use it in GitHub Desktop.
Save vojtajina/1014686 to your computer and use it in GitHub Desktop.
Angular Simple Widget with descend(true)
<!DOCTYPE HTML>
<html xmlns:ng="http://angularjs.org">
<script type="text/javascript" src="http://code.angularjs.org/0.9.16/angular-0.9.16.min.js" ng:autobind></script>
<script type="text/javascript">
angular.widget('my:test', function(element) {
// compile children elements ?
this.descend(true);
element.append('<button type="button" ng:click="testIt()">TEST</button>');
});
function Cntl() {
this.testIt = function() {
alert('It does work mate !');
};
}
</script>
<body ng:controller="Cntl">
<my:test></my:test>
</body>
</html>
@KurtWM
Copy link

KurtWM commented Jan 2, 2013

Thank you for this example, and your others. Learning AngularJS seems to require quite a bit of re-learning and re-thinking, and your posts have been the most helpful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment