2014-12-03 82 views
0

我已经使用AngularJS加载了一个页面。我有以下代码:Angular js是控制器没有加载

var app = angular.module("adhocAnalytical",[]); 
app.controller(
     "ReportController", 
     function ($scope,$http) { 

      $http({ 
       method: 'POST', 
       url: '/campustoolshighered/k12_reports_adhocreport4_analytical_body.do', 
       data: 'action=fetchinitdata', 
       headers: {'Content-Type': 'application/x-www-form-urlencoded'} 
      }) 
      .success(function(response) { 
       $scope.questions = response; 
       }); 
      } 
    ); 

angular.element(document).ready(function(){ 
    angular.bootstrap(document,['adhocAnalytical']); 
}); 

当我们在使用AngularJS的当前会话中第二次加载页面时,它不会加载。它给只写了JSP页面上,如表达:

{{question.title}} 
{{cell.f}}{{cell.f}} 
{{row.h}} {{row.v}} {{row.v}} 

回答

1

成功后的回调删除};

app.controller(
     "ReportController", 
     function ($scope,$http) { 

      $http({ 
       method: 'POST', 
       url: '/campustoolshighered/k12_reports_adhocreport4_analytical_body.do', 
       data: 'action=fetchinitdata', 
       headers: {'Content-Type': 'application/x-www-form-urlencoded'} 
      }) 
      .success(function(response) { 
       $scope.questions = response; 
       }); 
      } 

    ); 
+0

我不小心放置“};”提问后成功回调后。我没有 ”};”在我的代码实际上。 – 2014-12-03 14:37:57

相关问题