<div ng-app='directiveExample'> <hello></hello> </div>
angular.module('directiveExample', []) .directive('hello', function() { return { restrict: 'E', template: '<button>Hello Button</button>', replace: true, compile: function(element) { element.bind('click', function() { alert('Hello AngularJS!'); }); } } });