【发布时间】:2017-07-03 18:19:22
【问题描述】:
我有这样的 config()。
function config($httpProvider, $routeProvider) {
$httpProvider.interceptors.push('httpInterceptorService');
$routeProvider
.when('/detail/:id', {
controller: 'CourseDetailController',
controllerAs: 'vm',
templateUrl: 'templates/course-detail.html'
})
.otherwise({
redirectTo: '/'
});
}
查看
<a class="course--module course--link" href="/#/detail/{{ course._id }}">
当点击课程时,URL 编码如下,似乎没有发生路由。
http://localhost:5000/#!/#%2Fdetail%2F57029ed4795118be119cc43d
我试过了
从
href = "/#/detail/{{ course._id }}"中删除了/#,但这次URL变成了http://localhost:5000/detail/57029ed4795118be119cc43d,而不是拾取角度路由器并发出服务器请求。手动访问地址栏
URLhttp://localhost:5000/#!/detail/F57029ed4795118be119cc43d没有编码字符,这一次视图被正确更改。
有什么想法吗?
【问题讨论】:
标签: angularjs