$ location.path无法在控制器中工作

时间:2014-10-22 14:34:00

标签: angularjs

app.controller('LoginController', ['$http','$scope', function ($http, $scope, $location) {        

    $location.path("Home/Index");


}]);

浏览器在未定义时给出$ location的错误,我如何排除故障

1 个答案:

答案 0 :(得分:3)

您没有将$location添加到依赖表示法:

app.controller('LoginController', ['$http','$scope', '$location', function ($http, $scope, $location) {
    $location.path("Home/Index");   
}]);