【发布时间】:2016-12-11 11:23:57
【问题描述】:
我正在尝试从服务器上传文件,但文件未显示。对服务器的调用就是从这段代码开始的:
'use strict';
angular.
module('phoneList').
component('phoneList', {
templateUrl: 'phone-list/phone-list.template.html',
controller: ['Phone',
function PhoneListController(Phone) {
this.phones = Phone.query();
this.orderProp = 'age';
console.log(this.phones);
}
]
});
调用此服务:
'use strict';
angular.
module('core.phone').
factory('Phone', ['$resource',
function($resource) {
return $resource('phones/:phoneId.json', {}, {
query: {
method: 'GET',
params: {
phoneId: 'phones'
},
isArray: true
}
});
}
]);
返回码是 200,随后是 304,表示上传成功。但是前面代码段中的 console.log 语句并没有在控制台中显示电话。
【问题讨论】:
-
格式化程序没有按预期工作
标签: angularjs angular-promise angularjs-resource