码迷,mamicode.com
首页 > Web开发 > 详细

无法读取json数据 Error: [$http:baddata]

时间:2018-04-13 11:08:28      阅读:1100      评论:0      收藏:0      [点我收藏+]

标签:com   ges   containe   fun   keyword   bad   space   padding   plain   

控制台报了一处错误,并且在控制台页打印不出数据

1
2
3
4
5
6
7
8
9
10
11
 Error: [$http:baddata] http://errors.angularjs.org/1.6.4/$http/baddata?p0=%5B%7B%0D%0A%09%22id%22%…C%0D%0A%09%22like%22%20%20%20%20%3A%2298.93%25%22%0D%0A%7D%5D%3B&p1=%7B%7D
    at angular.min.js:6
    at nc (angular.min.js:96)
    at angular.min.js:97
    at q (angular.min.js:7)
    at xd (angular.min.js:97)
    at f (angular.min.js:99)
    at angular.min.js:134
    at m.$digest (angular.min.js:145)
    at m.$apply (angular.min.js:149)
    at l (angular.min.js:102) "Possibly unhandled rejection: {}"

我的代码,mainCtrl.js

1
2
3
4
5
angular.module(‘app‘).controller(‘mainCtrl‘,[‘$http‘,‘$scope‘,function ($http,$scope) {
    $http.get(‘/data/list.json‘).then(function(resp){
        $scope.list= resp.data;
    });
}]);

json数据

1
2
3
4
5
6
7
8
9
10
[{
    "id"      :"1",
    "imgSrc"  :"/image/list_1.jpg",
    "name"    :"黑眼豆豆",
    "oldPrice":"¥22.00",
    "newPrice":"¥9.00",
    "desc"    :"王祖蓝吃了说“完美”",
    "quantity":"438975",
    "like"    :"98.93%"
}];

无法读取json数据 Error: [$http:baddata]

标签:com   ges   containe   fun   keyword   bad   space   padding   plain   

原文地址:https://www.cnblogs.com/eryaketang/p/8818017.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!