【发布时间】:2016-06-12 05:55:53
【问题描述】:
我的phones.json 文件有问题。
我将文件夹 phones 和 phones.json 添加到我的项目中。
我写了 homeController.js:
var phonecatApp = angular.module("phonecatApp", []);
phonecatApp.controller('PhoneListCtrl',['$scope', '$http', function($scope,$http) {
$http.get('../phones/phones.json').success(function (data) {
$scope.phones = data;
});
$scope.orderPror = 'age';
}]);
为什么加载phones.json失败?感谢您的回答。
【问题讨论】:
-
试试这个./phones/phones.json
-
你能不能说明你把 homeController.js 放在哪里了?
-
我的 homeController 在 Controllers 文件夹中。