Skip to content
This repository was archived by the owner on Sep 8, 2020. It is now read-only.

Commit 8641d3c

Browse files
authored
Update Object.js
1 parent e1b01db commit 8641d3c

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

modules/Object.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ module.factory('BaseObject', ($q) => {
4545
}
4646

4747
/**
48-
* object.save() - Convenience wrapper
48+
* Convenience wrapper for update/create
4949
*
5050
* Sets an `object.saving` flag to the promise (truthy) and clears the flag when finished
5151
* Using `Promise.finally()` allows you to execute code on success OR fail withought affecting chaining
@@ -55,7 +55,7 @@ module.factory('BaseObject', ($q) => {
5555
}
5656

5757
/**
58-
* object.create() - stubbed with example state flag creating
58+
* Stubbed with example flag
5959
*
6060
* @note Use object.save() instead of calling this method directly
6161
*/
@@ -64,7 +64,7 @@ module.factory('BaseObject', ($q) => {
6464
}
6565

6666
/**
67-
* object.update() - stubbed with example state flag updating
67+
* Stubbed with example flag
6868
*
6969
* @note Use object.save() instead of calling this method directly
7070
*/
@@ -73,7 +73,7 @@ module.factory('BaseObject', ($q) => {
7373
}
7474

7575
/**
76-
* object.delete() - stubbed with example state flag updating
76+
* Stubbed with example flag
7777
*/
7878
delete() {
7979
return this.cache('deleting', () => $q.when(this) );
@@ -85,6 +85,11 @@ module.factory('BaseObject', ($q) => {
8585
* When you edit a record in a form, you want the original to be preserved while the user makes changes
8686
* This allows you to edit a record exactly as if you were creating one without having to worry about
8787
* rolling back changes to the object.
88+
*
89+
* @example
90+
* let editProject = project.clone();
91+
* editProject.title = 'New Title';
92+
* editProject.save(); // or discard
8893
*
8994
* @note This makes a shallow copy only
9095
*/

0 commit comments

Comments
 (0)