Skip to content

Document how to add custom methods to nested models #1043

@ianfp

Description

@ianfp

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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions