AngularJS$location赢得';我不能正确地改变路径

AngularJS$location赢得';我不能正确地改变路径,angularjs,Angularjs,由于某些原因,$location.path不会指向detail.html。表格行是可单击的,当您单击它们时,所有信息都会消失,它只显示警报。以下是我的控制器脚本: var-app=angular.module('list-module',[“ngRoute”]); app.config(函数($routeProvider){ $routeProvider.when(“/”{ templateUrl:'list.html', 控制器:“ListController” }) .when(“/det

由于某些原因,
$location.path
不会指向
detail.html
。表格行是可单击的,当您单击它们时,所有信息都会消失,它只显示警报。以下是我的控制器脚本:

var-app=angular.module('list-module',[“ngRoute”]);
app.config(函数($routeProvider){
$routeProvider.when(“/”{
templateUrl:'list.html',
控制器:“ListController”
})
.when(“/detail”{
templaterUrl:'detail.html',
控制器:“详细控制器”
})
.否则({
重定向到:'/'
});
});
app.controller(“ListController”、[“$scope”、“$location”、“$routeParams”,
功能($scope、$location、$routeParams){
$scope.customers=[{
id:0,
标题:“努拉”,
订单0:‘咖啡’,
网址:'http://static.iltalehti.fi/terveys/teekuppi1308MZ_tr.jpg'
}, {
id:1,
标题:“汤姆”,
订单0:‘茶’,
网址:'http://papunet.net/sites/papunet.net/files/kuvapankki/Kahvi.jpg-dup.jpg'
}, {
id:2,
标题:“劳里”,
订单0:“coce”,
网址:'http://static.makuja.fi/files/articles/1238382.515x325.jpg'
}];
$scope.detailView=函数(){
警报(“点击工作”);
$location.path(“/detail”).replace();
$scope.$apply();
};
}
]);请删除“$scope.$apply();”并重试


有关何时使用$scope的详细信息,请参阅此处。$apply()“”

为什么使用
.replace()
?不应该是
$location.path(“/detail”)?我两种都试过了,开始绝望了我试过了,也试过了。和with.replace()和with.replace()。此外,我还尝试使用链接到html,但它也不起作用。我想问题是我的angularjs/angularjs路由器或我提到的一些脚本已经过时或错误。我重新开始后,问题就解决了。