2014-12-03 86 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

相關問題