如果他应该<a href="">

时间:2016-01-18 14:59:24

标签: angularjs angularjs-routing

I have the following in one of my templates (under a folder name "partials")

<a href="index.html">&laquo; Back to search</a>

in one of my js I define the routing in the following way:

var app=angular.module("app",['ngRoute', 'playerControllers']);

app.config(['$routeProvider', function($routeProvider){
  $routeProvider.
      when('/list',{
    templateUrl:'partials/list.html',
    controller: 'ListController'
  }).
      when('/details/:itemId',{
        templateUrl:'partials/details.html',
        controller: 'DetailsController'
      }).
  otherwise({
    redirectTo: '/list'
  });
}]);

For some reason when I click on the back link it doesn't get to http://localhost:63342/mcaabiTLV/app/index.html#/list,则Angular不起作用。相反,它得到了 http://localhost:63342/mcaabiTLV/app/index.html#

1 个答案:

答案 0 :(得分:0)

你应该写:

<a href="#/list">&laquo; Back to search</a>