I am trying to access scope variable inside $scope.$on but it returns undefined, but if I use a normal variable it is working fine.
Example:
app.controller('myCtrl',function($scope){
this.a = "hello";
var b = "hi";
// some code
$scope.$on('someEvent',function(scope,ele,attrs){
console.log(this.a); // prints 'undefined'
console.log(b); //prints 'hi'
});
});