I am having a situation here, my website is built with angularjs. My entire routes are managed through angular. After my successful login, I redirect user to dashboard page. I have a show hide condition on an element, which stopped working now. Here's the code:
<div id="TilesController" ng-show="ShowTiles" ng-controller="TilesController">
<div class="" id="tiles" ng-include src="'tiles.html'"></div>
</div>
So tiles are only visible to loggedin users. After login, tiles should be visible, I listen to routechangesuccess event and change it according, but its not working.
$scope.$on('$routeChangeSuccess', function(event, next, current) {
if(userLoggedIn !== undefined){
$scope.ShowTiles = true;
}
});
But this is not enabling the tile, though if I console.log($scope.ShowTiles);
it shows true. I tried safeapply, but still not helping, but if I refresh the entire page, then it works.