user2908112 user2908112 - 4 months ago 7
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

.../players#%2Fplayers%2F4173


What's wrong?

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

http://angular.github.io/angular-phonecat/step-8/app/

SOLVED:

/#!/players/playerId



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

Answer

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>