Skip to content

Instantly share code, notes, and snippets.

@mgonto
Created April 27, 2013 01:33
Show Gist options
  • Select an option

  • Save mgonto/5471520 to your computer and use it in GitHub Desktop.

Select an option

Save mgonto/5471520 to your computer and use it in GitHub Desktop.
Restangular URL Building
var restangualrSpaces = Restangular.one("accounts",123).one("buildings", 456).all("spaces");
// This will do ONE get to /accounts/123/buildings/456/spaces
restangularSpaces.getList()
// This will do ONE get to /accounts/123/buildings/456/spaces/789
Restangular.one("accounts", 123).one("buildings", 456).one("spaces", 789).get()
// POST /accounts/123/buildings/456/spaces
Restangular.one("accounts", 123).one("buildings", 456).all("spaces").post({name: "New Space"});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment