SyntaxError:Object.parse(native)上的意外标记d AngulatJS 1.3.5

时间:2016-05-11 14:23:49

标签: javascript java html angularjs json

我使用java创建了一个Restful Web服务,结果就是这里(因为我必须保密,所以我在信息中做了一些更改)。我使用getter和setter动态获取这些信息      我的JSON文件:



[
     {
    "Name": "xxx",
    "Year": "yyy",  
    "AA": "bb", 
    "CC": [
       {
      "Situation": "OK","Situation": "OK","Situation": "OK","Situation":"OK","Situation": "OK","Situation": "OK","Situation": "OK","Situation":"OK","Situation": "OK","Situation": "OK","Situation": "OK","Situation":"OK","Situation": "OK","Situation": "OK","Situation": "OK"
   }
    ],
    "EE": [
     {
      "Situation": "OK", "Situation": "OK"
    }
    ],
     "MMM": "OK",
     "BBB": "OK",
     "LLL": "0.0.0.0"
   }
     ]




这是我的HTML代码:



<body ng-app="DynamicApp">
    <div ng-controller="MainController">
    <table>
     <tr>
                <th>Name</th>
                <th>Year</th>
                <th>AA</th>                    
                <th>CC</th>
                <th>EE</th>
                <th>MMM</th>
                <th>BBB</th>
                <th>LLL</th>
  
  </tr>
  <tr ng-repeat="x in data track by $index">
    <th>{{x.Name}}</th>
    <td>{{x.Year}}</td>
    <td>{{x.AA}}</td>
    <td>{{x.CC}}</td>                  
    <td>{{x.EE}}</td>
    <td>{{x.MMM}}</td>
    <td>{{x.BBB}}</td>
     <td>{{x.LLL}}</td>
 
  </tr>
</table>` 
&#13;
&#13;
&#13;

我的控制器:

&#13;
&#13;
app.controller('MainController', ['$scope', 'myapp', function($scope, myapp) {
  myapp.success(function(data) {
 
    $scope.data = data;
 
  });
}]);
&#13;
&#13;
&#13;

我的工厂:

&#13;
&#13;
app.factory('myapp', ['$http', function($http) {
  return $http.get('Url')
            .success(function(data) {
              return data;
            })
            .error(function(err) {
              return err;
            });
}]);
&#13;
&#13;
&#13;

和我的应用:

&#13;
&#13;
var app = angular.module('DynamicApp', []);
&#13;
&#13;
&#13;

每当我尝试使用AngularJS将我的JSON文件解析为HTML页面时,我都会收到此错误:

&#13;
&#13;
SyntaxError: Unexpected token d
    at Object.parse (native)
    at oc (http://ajax.googleapis.com/ajax/libs/angularjs/1.3.5/angular.min.js:14:136)
    at Yb (http://ajax.googleapis.com/ajax/libs/angularjs/1.3.5/angular.min.js:76:271)
    at http://ajax.googleapis.com/ajax/libs/angularjs/1.3.5/angular.min.js:77:117
    at r (http://ajax.googleapis.com/ajax/libs/angularjs/1.3.5/angular.min.js:7:302)
    at Vc (http://ajax.googleapis.com/ajax/libs/angularjs/1.3.5/angular.min.js:77:99)
    at c (http://ajax.googleapis.com/ajax/libs/angularjs/1.3.5/angular.min.js:78:205)
    at http://ajax.googleapis.com/ajax/libs/angularjs/1.3.5/angular.min.js:111:252
   at k.$eval (http://ajax.googleapis.com/ajax/libs/angularjs/1.3.5/angular.min.js:125:120)
    at k.$digest (http://ajax.googleapis.com/ajax/libs/angularjs/1.3.5/angular.min.js:122:218)(anonymous function) @ angular.js:11500(anonymous function) @ angular.js:8479(anonymous function) @ angular.js:13083k.$eval @ angular.js:14291k.$digest @ angular.js:14107k.$apply @ angular.js:14395m @ angular.js:9569N @ angular.js:9756w.onload @ angular.js:9697
&#13;
&#13;
&#13; 我迷路了自从被封锁以来已经有4个小时了。注意:我在这里查看了所有现有的答案,但是徒劳无功。

0 个答案:

没有答案