AngularJS脚本给出错误ReferenceError赋值左侧无效

Cor*_*lis 4 javascript angularjs

在与Web服务建立连接的过程中,我尝试使用AngularJS $ http选项对其进行管理。但是,当我尝试对其进行测试时,我在chrome控制台中遇到了下一个错误:ReferenceError分配的左侧无效。我检查了3次代码,但无法弄清楚自己在做什么错。这是我的睾丸:

<!doctype html>
<html ng-app>
  <head>
    <title>Test webservice</title>
      <script type="text/javascript" src="./jquery-1.9.1.js"></script>
      <script type="text/javascript" src="./angular.min.js"></script>
      <script type="text/javascript" src="./angular-resource-min.js"></script>
      <script type="text/javascript">
        function testWebservice($scope, $http) {
          $scope.testService() = function() {
            $http.get("http://localhost:1325/hello/world")
              .success(function(data, status, headers, config) {
                alert(data);
              })
              .error(function(data, status, headers, config) {
                alert(status);
              });
          };
        }

      </script>
    <head>
  <body>
    <div ng-controller="testWebservice">
      <form ng-submit="testService()">
        <input type="submit" value="test">
      </form>
    </div>
  </body>
</html>
Run Code Online (Sandbox Code Playgroud)

我在www.angularjs.org上使用了“添加某些控件”示例作为测试脚本。我的Web服务等于ServiceStack的教程:http : //www.servicestack.net/ServiceStack.Hello/

我的问题是,什么原因导致我在angular.min.js文件中收到错误?

Che*_*niv 5

似乎这是有问题的:

$scope.testService() = function() {
Run Code Online (Sandbox Code Playgroud)

可能是您应该尝试像这样更改它:

$scope.testService = function() {
Run Code Online (Sandbox Code Playgroud)