私は例に従いましたが、カスタム メソッドをリソースのプロトタイプに追加するときに何か問題があるようです。
app.factory('Product',function ($resource,$cacheFactory) {
var Product = $resource('/the/url/:id', {id: '@id'}),
cache = $cacheFactory('Product'),
products;
Product.prototype.all = function(){
products = cache.get('all');
if(typeof products == 'undefined'){
products = Product.query();
cache.put('all',products);
}
return products;
};
return Product;
})
コントローラーで私はします$scope.products = Product.all();
が、私は得ます
TypeError: Object function Resource(value) {
copy(value || {}, this);
} has no method 'all'