Master Page Controllerjs:
I am want to get following categoryId from event fired by $scope.braodcast on my event(inner) page.
$scope.RedirectToEventPage = function (categoryId) {
var url = window.location.host + '/events';
if (categoryId == 'ALL') {
$rootscope.$broadcast('CategoryId', 0);
}
else {
$scope.$broadcast('CategoryId', categoryId);
}
window.location = '/events';
};
Event Page Controllerjs: $scope.on displaying 'undefined' with console.
knrApp.controller("EventCtrl", function ($scope, eventFactory, $rootscope) {
$(document).ready(function () {
$rootscope.$on('CategoryId', function (event, data) {
if (data == null || data === undefined || data == '') {
$scope.categoryId = 0;
}
else {
$scope.categoryId = data;
}
});
// $scope.categoryId = 0;
console.log($scope.categoryId);
$scope.GetAllEventData($scope.categoryId);
});
}