我有一些状态设置如下:
.state('view-course', {
url: "/view-course",
templateUrl: "views/viewCourse.html"
})
.state('view-course.viewBlockContent', {
url: "/:courseid/:blockid",
templateUrl: "views/viewBlockContent.html",
controller: function($stateParams, $scope, $rootScope) {
$scope.params = $stateParams;
$rootScope.blockParameters = $stateParams;
}
})
.state('view-course.viewBlockContent.question', {
url: "/:questionid",
templateUrl: "views/questionTemplate.html",
controller: function($stateParams, $scope, $rootScope) {
$scope.params = $stateParams;
$rootScope.questionParameters = $stateParams;
}
})
.state('view-course.viewBlockContent.report', {
url: "/report",
templateUrl: "views/goalReport.html",
controller: function($stateParams, $scope, $rootScope) {
$scope.params = $stateParams;
$rootScope.questionParameters = $stateParams;
}
})
问题出现在view-course.viewBlockContent.question
和view-course.viewBlockContent.report
区域,我在HTML中引用了这样的报告子视图:
<a ui-sref="view-course.viewBlockContent.report">REPORT IN</a>
当我点击REPORT IN
它实际加载questionTemplate.html
而不是goalReport.html
时,奇怪的是网址结构会附加/report
或{{1}填充正确,但它加载第一个文件(例如,如果我在问题状态之前移动报告状态,它会加载/:questionid
文件。