2014-10-22 25 views
-1

JSLint告訴我這個消息:「預期的標識符,而是看到']'。」 這是使用Javascript.Her我第一次是我的代碼:預期的標識符,而不是看到

 (function() { 
"use strict"; 
    } 
    ()); 

    angular.module('Umfrage', 'Auswertung'[]) 
     .controller('mainCtrl', ['$scope', '$log', '$http', function ($scope, $log, $http) { 
      $scope.vorname = []; 
      $scope.umfrageData = []; 


      $scope.test = function() { 
       $log.log($scope.vorname); 
      }; 



       $scope.submitForm = function (data) { 
       $scope.umfrageData.push(data); 
       $http.post("http://localhost:8080/Auswertung") 


       $http.get("http://localhost:8080") 
       .success(function (response) {$scope.umfrageData = response; }); 
       $log.log($scope.umfrageData); 
      }; 

     }]); 
+1

你''Auswertung'' – lyschoening 2014-10-22 06:02:47

+0

@lyschoening後忘了一個逗號。幾乎是corect。 'Auswertung'應該是數組中的一個項目 – Sprottenwels 2014-10-22 06:03:27

+0

@Sprottenwels你是對的。我只看着語法。 – lyschoening 2014-10-22 11:07:17

回答

2

這條線:

angular.module('Umfrage', 'Auswertung'[])

正在創建一個模塊,名爲 'Umfrage'。第二個參數應該是一個數組,它包含匹配你想要聲明爲你正在創建的模塊的依賴關係的模塊名字的字符串項。

因此,這將是正確的,假定有一個名爲模塊 'Auswertung'

angular.module('Umfrage', ['Auswertung'])

module API