Why am I unable to redirect to a different URL using $location.path in angular.js?
.controller('CheckCtrl', function($scope, $localStorage, $location) {
$scope.check = function(){
if($localStorage.hasOwnProperty("accessToken") === true) {
alert("CheckCtrl logged in" + $localStorage.accessToken);
$location.path("/post-report");
}else{
alert("CheckCtrl not logged in" + $localStorage.accessToken);
$location.path("home.login");
}
};
})
Despite the fact that $localStorage.hasOwnProperty is true and already contains token from Facebook.
I have also attempted using $location.reload() without success.