lightningfire
lightningfire

Reputation: 117

Have links use AngularJS routing instead of MVC routing

I have a SPA which uses an AngularJS front end and C# back end. The issue I'm having is when I navigate to the login page, it is using @Html.Partial("_LoginPartial"). The url then becomes .../Account/Login.

When I click on say the "About" tab, this uses an AngularJS route which in turn instead of routing me to the About Page, it tacks on the route to the end of the login route like so: .../Account/Login#/about and obviously doesn't route anywhere.

Would anyone know how I would resolve this? I have spent hours looking into this issue and haven't really found anything as of yet.

Upvotes: 3

Views: 39

Answers (1)

DfKimera
DfKimera

Reputation: 2146

What you need to do is setup the $location service to use HTML5 mode, which uses the HTML5 History API to modify the URL on the fly.

See:

Upvotes: 1

Related Questions