$ state.go无法正常工作。 我不知道为什么..
模板
<td class="text-center">
<button class="button button-small" ng-repeat="item2 in studentList" ng-if="item.id == item2.id" ng-click="studentDetailgo(item2.id, item2.col_code, item2.major_code, 2017, 2)">Detail
</button>
</td>
控制器
$scope.studentDetailgo= function(id, col_code, major_code, year, season) {
console.log(1);
$state.go('studentDetailgo', {
"id": id,
"col_code": col_code,
"major_code": major_code,
"year": year,
"season": season
});
console.log(2);
}
log(1),log(2)输出。但$ state.go无法正常工作
app.js
.state('studentDetailgo', {
url: '/studentDetailgo/:id/:col_code/:major_code/:year/:season',
views: {
'mileage': {
templateUrl: 'templates/searchDetail.html',
controller: 'MileageStudentDetailCtrl'
}
}
})
我该怎么做....
答案 0 :(得分:0)
I already check your routing its right
.state('studentDetailgo', {
url: '/studentDetailgo/:id/:col_code/:major_code/:year/:season',
views: {
'mileage': {
templateUrl: 'templates/searchDetail.html',
controller: 'MileageStudentDetailCtrl'
}
}
})
还要检查你的控制器范围功能吧。
可能是你没有在这个控制器中注入 $ state ,或者你没有注入 $ stateParams 来获取 MileageStudentDetailCtrl中的那些值控制器