Created
April 19, 2013 19:29
-
-
Save mgonto/5422621 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var allAccounts = Restangular.all("accounts"); | |
| // GET /accounts | |
| allAccounts.getList().then(function(accounts) { | |
| // Get /accounts/123/users considering 123 is the ID of accounts[0] | |
| accounts[0].getList("users").then(function(users) { | |
| // POST /accounts/123/users | |
| users.post({name: "Gonto"}) | |
| var oneUser = users[0]; | |
| oneUser.name = "Hey jude"; | |
| // PUT /accounts/123/users/4556 | |
| oneUser.put() | |
| }) | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment