1

I defined the following service:

myServices.factory('MyManager', ['$resource',
    function ($resource) {
        return $resource('../rest/contract/:contractId', {contractId:'@contractId'}, {
            findById: {method: 'GET', contractId: '@contractId'}
        });
    }]);

I want to make the REST call and, in my controller, I am doing this:

MyManager.findById(contractId,
            // on success
            function (response) {
                // do
            },
            // on error
            function () {
                alert("Error");
            });

However, the generated URL is <base>/rest/contract and no path variable is appended. The parameter I am passing to findById is not null.

What am I doing wrong?

1 Answer 1

3

You have to pass the parameter as an object:

MyManager.findById({contractId: contractId}, ...
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.