user2908112 user2908112 - 1 year ago 66
AngularJS Question

Angularjs-route href not evaluated

When I try to route from /players to /players/:playerId in my Angularjs-porject the URL updates to players#/players/4173 and not to the desired players/4173. This is the href:

<a href="#/players/4173">playerName</a>

and this is the route config:

when('/players/:playerId', {
template: '<player-detail></player-detail>'

I can manually type .../players/4173 and it works, but when clicking it does not work and I see the URL


What's wrong?

The live code from Angularjs own tutorial has the same error in my browser:



They missed that (#!) in the early example code of the tutorial I followed.

Answer Source

When you now navigate to /index.html, you are redirected to /index.html#!/players than your links should look like this:

<a href="#!/players/4173">playerName</a>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download