0

I am currently trying to set up a table to go to a profile page when you click a row. But $location.url will simply append the 'profile.html' to the end of the current html page and not take me to the profile page. How do I change the current url to allow me to go to my page.

index html:

http://localhost:9080/AgentOnlineApp/index.html

html I get when I click the row:

http://localhost:9080/AgentOnlineApp/index.html#/profile.html

I want:

http://localhost:9080/AgentOnlineApp/profile.html

current AngularJS code:

$scope.selectTableRow = function(agent)
    {

        $location.url('/profile.html');

    }

2 Answers 2

1

You might want to try this to load another page (outside your application):

$window.location.replace("profile.html")

Don't forget to inject $window

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

Comments

0

If you want to use the HTML5 history API, you need to set:

$locationProvider.html5Mode(true);

If you actually want to change the location entirely and reload the page, you are not quite using Angular as intended since this wouldn't be a single page app. However, you could do it with window.location = "profile.html"

Comments

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.