Can you build a URL in Restangular with multiple variables?


I am trying to build a resource in Restangular with a URL that has multiple variables. The server variable is set, so I need to figure out how to do this client side.

This is the URL that I was using in ngResource:


There isn’t really any nesting past shipped-orders, it’s just passing parameters through the URL.

I tried chaining them like:'shipped-order', '2013-11-04').one('', 'bulk')

But that turned out a url with double slashes in it.


I recently ran into this problem. Here’s what I did:

myApp.factory('myRestService', ['Restangular', function(Restangular) {
    return {
        myFunction: function(varA, varB, varC) {
            var path = "rest/primaryPath/" + varA + "/" + varB + "/" + varC;
            var restObject = Restangular.all(path);
            var thePromise = restObject.getList();

            return thePromise;

By building the path myself, I was successfully able to use more than one variable and get a result from the Java Rest Service I was using in my project.

Answered By – C1pher

Answer Checked By – Marilyn (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.