Directive:&
by vishwackh89
HTML
<link rel="stylesheet" href="http://twitter.github.com/bootstrap/assets/css/bootstrap.css">
<div ng-app="app">
<h2>Directive:&</h2>
<div ng-controller="appCtrl">
<div phone dail="callHome()"></div>
</div>
</div>
JavaScript
var app = angular.module("app",[]);
app.controller("appCtrl",function($scope){
$scope.callHome = function(){
alert("Calling Home...");
}
});
app.directive("phone",function(){
return{
scope:{
dail:"&"
},
template:'<button class="button" ng-click="dail()">Call Home</button>'
}
});