0

I have a SPA that uses angular routing. I would like to have a certain link that will open a specific page (not using a template) when clicked.

In other words I would to have some links that simply act as regular links and redirect the user to a new page. I don't want these links load inside of the template.

Surely this has to be possible right?

Many Thanks, Kiran

1 Answer 1

1

If I understood your question right, you wanna replace the enitre current page with a redirect to a new external page? If that so, you can definately do that using $location service just a s follows:

$window.location.href = 'http://www.google.com';

Just put that into an ng-click, then inject the $location service into your controller and you are good to go.

Further documentation on :

https://docs.angularjs.org/guide/$location

similar question on :

Redirect to new Page in AngularJS using $location

Sign up to request clarification or add additional context in comments.

1 Comment

Actually I hadn't thought of putting that into an ngClick!! Perfect! Thank you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.