restangular
restangular copied to clipboard
Document how to add custom methods to nested models
Can you document how to add custom methods to a nested resource? My code looks like this:
app.factory('Storefront', ['Restangular',
function(Restangular) {
return Restangular.service('storefront');
}]);
app.controller('StorefrontProductList', [
'$scope', '$filter', 'Storefront',
function($scope, $filter, Storefront) {
Storefront.one(storeId).get().then(function(store) {
$scope.store = store;
store.getList('products').then(function(products) {
$scope.products = products;
});
});
}]);
I want to add custom methods to products, which are nested under storefronts like so: /storefront/{id}/products.
Can you check this PR? https://github.com/FabienDehopre/restangular/commit/204dab5fc44617bb92fa1e1829ae4bceb0fe0b2d I think that should work for you.
@ianfp Were you able to resolve this issue?
@daviesgeek I haven't because I've been migrating to Angular2 and have phased out Restangular. Sorry!