이것은 angularjs의 내 컨트롤러입니다.
(function(){
"use strict";
angular
.module("testApp")
.controller("testAppCtrl", function($scope , $http){
$http.get('/data/testapp.json').then(function(data){
//$scope.testapps = testapp.data;
console.log(data);
});
});
})();
그리고 나는이 오류에 직면
angular.js:13708 SyntaxError: Unexpected token p in JSON at position 130
어떻게 고칠 수 있습니까?
귀하의 json 파일에 유효하지 않은 코드가 있습니다. 게시 된 주변에 따옴표가 누락되어 있으며 및 추가 연락처도 삽입되어 있습니다.
[{
"id": "1",
"title": "test1",
"description": "test 1 test 1 test 1 test 1 test 1 ",
"price": "2000",
"posted": "2015-10-24",
"contact": {
"name": "test1 mona",
"phone": "98765678",
"email": "[email protected]"
},
"categories": [
"vehicle",
"test"
],
"image": "1.jpg",
"views": "200"
}, {
"id": "2",
"title": "test2",
"description": "test 2 test 2 test 2 test 2 test 2 ",
"price": "2000",
"posted": "2015-10-24",
"contact": {
"name": "test2 mona",
"phone": "98765678",
"email": "[email protected]"
},
"categories": [
"vehicle",
"test"
],
"image": "1.jpg",
"views": "200"
}, {
"id": "3",
"title": "test3",
"description": "test 3 test 3 test 3 test 3 test 3 ",
"price": "3000",
"posted": "2015-10-24",
"contact": {
"name": "test3 mona",
"phone": "98765678",
"email": "[email protected]"
},
"categories": [
"vehicle",
"test"
],
"image": "1.jpg",
"views": "100"
}, {
"id": "4",
"title": "test4",
"description": "test 4 test 4 test 4 test 4 test 4 ",
"price": "4000",
"posted": "2015-10-24",
"contact": {
"name": "test4 mona",
"phone": "98765678",
"email": "[email protected]"
},
"categories": [
"vehicle",
"test"
],
"image": "1.jpg",
"views": "40"
}, {
"id": "5",
"title": "test5",
"description": "test 5 test 5 test 5 test 5 test 5 ",
"price": "5000",
"posted": "2015-10-24",
"contact": {
"name": "test5 mona",
"phone": "98765678",
"email": "[email protected]"
},
"categories": [
"vehicle",
"test"
],
"image": "1.jpg",
"views": "290"
}, {
"id": "6",
"title": "test6",
"description": "test 6 test 6 test 6 test 6 test 6 ",
"price": "6000",
"posted": "2015-10-24",
"contact": {
"name": "test6 mona",
"phone": "98765678",
"email": "[email protected]"
},
"categories": [
"vehicle",
"test"
],
"image": "1.jpg",
"views": "10"
}]
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다