BlondePainter BlondePainter - 5 months ago 25
AngularJS Question

Angular page redirection if returned value is false

in my controller i have this code that simply get the


app.controller('dashboardCtrl', function($scope, $stateParams, $http) {
$scope.displaySN = '';
$scope.studentNumber = sessionStorage.getItem('student_number');
$scope.get_logged_status = sessionStorage.getItem('logged_status');
console.log("Dashboard Page Logged Status: " + $scope.get_logged_status);

console.log('should redirect because false');
console.log('should stay because true');


it is getting the correct value but when i test the value of it and log a certain statement, im getting an unexpected result. in the image below, instead of getting
should redirect because false
is valued
, im getting the opposite result. Help Please. Am i coding it wrong?

Please see image here

enter image description here


try this :


maybe the item logged_status in the sessionStorage is considered as string not a boolean, so it returns always true