my controller is-
var App = angular.module("App",[]);
App.controller("MainController",['$scope',function($scope){
$scope.getDetail = function(){
console.log("get detail call from main controller");
}
}]);
directive is-
App.directive('customDirective',[function(){
retu {
restrict : 'EAC',
scope : {
},
template :'<div><button type="button">click here to get detail</button></div>',
link : function(scope,element,attribute){
}
};
}]);
page html is-
<div ng-controller="MainController">
<custom-directive></custom-directive>
</div>
i am trying to call the getDetail in MainController on click of button inside the custom directive.
