应为标识符,但却看到

Expected an identifier and instead saw

本文关键字:标识符      更新时间:2023-09-26

JSLint显示以下消息:"需要一个标识符,而看到的却是']'。"这是我第一次使用Javascript。她是我的代码:

       (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);
            };
        }]);

此行:

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

正在创建一个名为"Umfrage"的模块。第二个参数应该是一个数组,包含与要声明为所创建模块的依赖项的模块名称相匹配的字符串项。

因此,假设有一个名为"Auswertung"的模块,这是正确的

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

请参阅模块API