Skip to content

Instantly share code, notes, and snippets.

@nrchandan
Created October 28, 2014 10:42
Show Gist options
  • Save nrchandan/1ae47b66c5056fe847fd to your computer and use it in GitHub Desktop.
Save nrchandan/1ae47b66c5056fe847fd to your computer and use it in GitHub Desktop.
Angular $location issue
$http.post('/campaignauth', payload).success(function(data) {
console.log(data);
if (data.response.status == 'error') {
//display alert to user
} else {
// $cookieStore.put("AMBC_SSID", data.response.token);
// The below code is intentionally set to run after a
// small delay due to cookie not being set by the time
// the location path changes. Better way to fix this
// is to set the cookie manually, as shown above, but
// it causes some encoding issues due to which cookie
// gets rejected by the server.
setTimeout(function() {
// $location.path('/campaigns');
window.location.href = "/#/campaigns";
}, 100);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment