Last active
December 29, 2015 13:19
-
-
Save bitrut/7676303 to your computer and use it in GitHub Desktop.
Desired Angular model example
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 person = new Person({firstName: 'John', lastName: 'Smith'}); // Object created on client side without calling API | |
var promise = person.save(); // $save()? POST request to API to create the object in backend DB | |
promise.then(function(success){ | |
alert('ok'); // whatever | |
}); | |
person.firstName = 'Michael'; | |
promise = person.save(); // PUT request to API to update object in the backend | |
promise.then(function(success){ | |
alert('ok'); // whatever | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment