Created
January 12, 2014 05:36
-
-
Save robwormald/8381375 to your computer and use it in GitHub Desktop.
This file contains 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
//angular syntax | |
//get all dogs | |
//return all brown dogs | |
// GET /dogs?color=brown | |
$http.get('/dogs',{params :{color : 'brown'}}).then(function(dogs){ | |
//dogs is an array of dog objects | |
}) | |
//create a new dag | |
var newDog = { | |
color : 'black', | |
name : 'fido | |
} | |
//create a new dog | |
$http.post('/dogs',newDog).then(function(fido){ | |
//change fido's name | |
fido.name = 'Lassie' | |
$http.put('/dogs/' + fido.id , fido ).then(function(lassie){ | |
console.log(lassie) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment