Hi I'm new to angularjs and I'm using $rootScope to change a $scope variable on $stateChangeSuccess. The problem is, i get an error message that says, "TypeError: Cannot set property 'show' of null". This is a snipet of my code
// unhide this view whenever visited
$rootScope.$on('$stateChangeSuccess', function(event, toState, toParams, fromState, fromParams) {
$scope.$parent.show = false;
alert($scope.$parent.show);
return $scope.$parent.show;
});
and the html ...
<div class="row">
<div class="dl-horizontal" id="information">
<div class="col-md-8 col-md-offset-2">
<!-- route veiw, hide the child view initailly -->
<div ui-view ></div>
</div>
<div class="col-md-8 col-md-offset-2" ng-hide="show">
Basically, I want to unhide the parent view whenever I get out of the child state. The $scope variable has a value to it and the code works, it's just that I get this error message. Any ideas on how to solve this error?
Thanks