財產「查詢」我熟悉自己與AngularJS和撥打電話到Web API後臺,我得到的獲取類型錯誤:無法讀取的不確定
angular.js:13424 TypeError: Cannot read property 'query' of undefined
錯誤我有一個productListController
(function()
{
"use strict";
angular.module("productManagement").controller("ProductListController", ["productResource", ProductListController]);
function ProductListController($scope, productResource) {
productResource.query(function (data) {
$scope.products = data
});
}
})();
,我創建了一個名爲productResource
(function() {
"use strict";
angular.module("common.services").factory("productResource", ["$resource", "appSettings", productResource])
function productResource($resource, appSettings) {
return $resource(appSettings.serverPath + "/api/products/:id").query();
}
}());
該服務的appSettings是一個常數指定一個路徑。
爲什麼query
未定義?
這一切都有道理,感謝你 – Arianule