Say I've got a model Kitty with two required fields, name and favoriteSnack. I want to let people edit Kitties in a view with a form that looks like:
Edit Kitty
Name: [______________]
Favorite snack: [__________________]
[Submit]
I'm stuck -- the boring days of GET and POST seemed to be easier. So what's a good pattern for setting this up with AngularJS? Specifically,
- How should I set up my URLs and methods? Does
ngResourcedo this automatically? I'm guessing,GET /kitties- list all kittiesGET /kitties/:id- get a single kittenPOST /kitties- create a new kittyPUT /kitties/:id- update a kittyDELETE /kitties/:id- delete a kitty
- On submit, should I validate the model client-side or server-side?
- If server-side, how do I handle non-200 responses from the REST API that I've hooked my model up to?
- How should I propagate errors back to the user?
- Can I do validate-as-you-type?
Please forgive me if I've missed something obvious.