Skip to content

Instantly share code, notes, and snippets.

@robwormald
Created January 12, 2014 05:36
Show Gist options
  • Save robwormald/8381375 to your computer and use it in GitHub Desktop.
Save robwormald/8381375 to your computer and use it in GitHub Desktop.
//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