dimanche 4 janvier 2015

AngularJS goto home screen after login

Hello I'm new to AngularJS but I can't fix something. I have this controller:



.controller('LoginCtrl', function($scope, $location){
$scope.fbLogin = function() {
openFB.login(
function(response) {
if (response.status === 'connected') {
console.log('Facebook login succeeded');
} else {
alert('Facebook login failed');
}
},
{scope: 'email,publish_actions,user_friends,read_friendlists'});
};
console.log(openFB.getLoginStatus() == 'connected');
if(openFB.getLoginStatus() == 'connected'){
$location.path("profile").replace();
$location.reload(true);
}
})


And I want after successful login to redirect to the profile page. But this doesn't work unless I reload the page manually. What is the right way to do it?


Thanks in advice :)


Aucun commentaire:

Enregistrer un commentaire