Angular ui.router子状态无法正常工作

时间:2015-11-19 18:31:37

标签: angularjs angular-ui-router

我有一些状态设置如下:

.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.questionview-course.viewBlockContent.report区域,我在HTML中引用了这样的报告子视图:

<a ui-sref="view-course.viewBlockContent.report">REPORT IN</a>

当我点击REPORT IN它实际加载questionTemplate.html而不是goalReport.html时,奇怪的是网址结构会附加/report或{{1}填充正确,但它加载第一个文件(例如,如果我在问题状态之前移动报告状态,它会加载/:questionid文件。

0 个答案:

没有答案