Redirect To An Absolute Url In Angularjs
How to redirect user to an absolute url in angularjs. For example: i have a page, my current url (http://example.com/submit), once the user click some button in the web page, he
Solution 1:
You need to use the browser level API, with the object window
, or you can inject the $window
reference in your controller.
window.location.href="http://www.google.com";
$window.location.href="http://www.google.com";
References:
Best solution should be perform redirect in your $routeProvider
configuration, injecting the $window
object and performing all redirection you need.
Solution 2:
What about simple window.location.href = "http://google.com"
?
Solution 3:
I had some issues with the above solutions and came across this and thought I would share. Be sure to inject '$timeout', '$window' into your controller.
$timeout(function() {
$window.location.assign('https://URL');
}, 3000);
Solution 4:
you can use window.location.href=""
and in between your quotes you can place your respective url
Post a Comment for "Redirect To An Absolute Url In Angularjs"