Reputation: 127
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');
}
Upvotes: 0
Views: 69
Reputation: 191729
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"
Upvotes: 0
Reputation: 1839
You might want to try this to load another page (outside your application):
$window.location.replace("profile.html")
Don't forget to inject $window
Upvotes: 1