I have 2 controllers and one service.From one controller calling service and result $emit to another controller in another page .but its not working.Please help.Thanks in advance.
In first controller
routerApp.controller('DetailCtrl',['$scope''ChefService','$rootScope',function($scope,ChefService,$rootScope){
$scope.Fn_ClickChefProfile = function(chefid){
ChefService.GetChefProfile(chefid).then(function(d){
$rootScope.$emit("CallToChef",d);
});};]});
In second controller
routerApp.controller('ChefCtrl',['$scope','$rootScope','ChefService',function($scope,$rootScope,ChefService){
$rootScope.$on("CallToChef",function(event,data){
$scope.Fn_GetChefProfile(data);
});
$scope.Fn_GetChefProfile = function(data){
console.log(data);
};}]);