我是新手在angularjs,我有一个带有锚标签的一些数据的索引页,当用户点击一个特定的锚标签页面时,重定向到列表页面并显示数据,但ngRoute不工作,也没有得到查询字符串值。我哪里错了
这是我的索引页面
<div class="all_cat" ng-repeat="state in statelist">
<h2>{{state.Statename}}</h2>
<div class="cat-col-4" ng-repeat="citylist in state.city">
<ul>
<li><i class="fa fa-caret-right"></i><a href="/Job/JobList/{{citylist.ID}}">{{citylist.cityname}} </a>({{citylist.jobcount}})</li>
</ul>
</div>
<div class="clear"></div>
</div>这是我的js
var app = angular.module('angularTable', ['ngSanitize', 'ui.select', 'angularTrix', 'ngRoute']);
app.config(function($routeProvider) {
debugger;
$routeProvider
.when('/JobList:ID', {
templateUrl: 'job/JobList.cshtml',
controller: 'joblist'
})
});
app.controller('joblist', function($scope, $routeParams) {
debugger;
$scope.message = 'Clicked person name from home page should be display here';
$scope.person = $routeParams.ID;
});我不能理解我哪里做错了
发布于 2016-09-23 22:15:19
Ass braja lal Mahanty告诉你可能需要/JobList/:ID而不是/JobList:ID。所以你必须将状态设置为:
$routeProvider
.when('/JobList/:ID', {
templateUrl: 'job/JobList.cshtml',
controller: 'joblist'
})
});https://stackoverflow.com/questions/39662474
复制相似问题