这是我的http服务代码:
app.controller('StoreController', ['$http', function($http){
var store = this;
store.products = [];
$http.get('/store-products.json').then(function(data){
store.products = data;
});
}]);
这是我的JSON代码:
[
{
"name": "...",
"price": 20.00,
"description": "...",
"canPurchase": false,
"images": [
"...jpg",
"...jpg",
"...jpg"
],
"reviews": []
},
{
"name": "...",
"price": 15.95,
"description": "...",
"canPurchase": true,
"images": [],
"reviews": []
}
]
当我在localhost服务器上运行代码时,它不会显示我的对象。控制台中也没有错误显示,所以我无法看到我出错的地方。谁能在这里看到这个问题?
答案 0 :(得分:1)