Angular: Empty Fiddle
http://angularjs.org/
by mrajcok
HTML
<script src="http://code.angularjs.org/angular-1.0.1.js"></script>
<div ng-controller="MyCtrl">
<div ng-click='back()' button='go back!'></div>
</div>
JavaScript
var myApp = angular.module('myApp',[]);
function MyCtrl($scope) {
$scope.back = function() {
alert('back');
}
}
myApp.directive("button", function () {
return {
scope: false, // this is the default, so you could remove this line
template: "<div><div another-directive></div>{{button}}</div>",
replace: true,
link: function (scope, element, attrs) {
scope.button = attrs.button;
}
};
});