angular with &
HTML
<div ng-app="myApp" ng-controller="myCtrl">
<alert-it make-alert="doAlert(msg)"></alert>
</div>
JavaScript
var app = angular.module('myApp',[]);
app.controller('myCtrl',['$scope',function($scope){
$scope.doAlert=function(Msg) {
alert(Msg);
}
}]);
app.directive('alertIt',function(){
return {
restrict:'E',
scope:{
makeAlert:'&'
},
link:function(scope,ele,attrs){
scope.makeAlert({msg:'hello world'})
}
}
})