Skip to content

Commit efc8b3f

Browse files
committed
Updated docs.
1 parent 6e04398 commit efc8b3f

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

dist/angular-data.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -2554,6 +2554,7 @@ function errorPrefix(resourceName) {
25542554
* - `{boolean=}` - `useClass` - Whether to wrap the injected item with the resource's instance constructor.
25552555
* - `{boolean=}` - `cacheResponse` - Inject the data returned by the adapter into the data store. Default: `true`.
25562556
* - `{boolean=}` - `upsert` - If `attrs` already contains a primary key, then attempt to call `DS.update` instead. Default: `true`.
2557+
* - `{boolean=}` - `eagerInject` - Eagerly inject the attributes into the store without waiting for a successful response from the adapter. Default: `false`.
25572558
* - `{function=}` - `beforeValidate` - Override the resource or global lifecycle hook.
25582559
* - `{function=}` - `validate` - Override the resource or global lifecycle hook.
25592560
* - `{function=}` - `afterValidate` - Override the resource or global lifecycle hook.
@@ -2655,6 +2656,12 @@ function create(resourceName, attrs, options) {
26552656
} else {
26562657
return DS.createInstance(resourceName, attrs, options);
26572658
}
2659+
})
2660+
.catch(function (err) {
2661+
if (options.eagerInject && options.cacheResponse) {
2662+
DS.eject(resourceName, injected[definition.idAttribute], { notify: false });
2663+
}
2664+
return DS.$q.reject(err);
26582665
});
26592666
}
26602667
} catch (err) {
@@ -2700,7 +2707,7 @@ function errorPrefix(resourceName, id) {
27002707
*
27012708
* - `{function=}` - `beforeDestroy` - Override the resource or global lifecycle hook.
27022709
* - `{function=}` - `afterDestroy` - Override the resource or global lifecycle hook.
2703-
* - `{boolean=}` - `eagerInject` - If `true` eagerly eject the item from the store without waiting for the adapter's response, the item will be re-injected if the adapter operation fails. Default: `false`.
2710+
* - `{boolean=}` - `eagerEject` - If `true` eagerly eject the item from the store without waiting for the adapter's response, the item will be re-injected if the adapter operation fails. Default: `false`.
27042711
*
27052712
* @returns {Promise} Promise produced by the `$q` service.
27062713
*

dist/angular-data.min.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/datastore/async_methods/create.js

+7
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ function errorPrefix(resourceName) {
3535
* - `{boolean=}` - `useClass` - Whether to wrap the injected item with the resource's instance constructor.
3636
* - `{boolean=}` - `cacheResponse` - Inject the data returned by the adapter into the data store. Default: `true`.
3737
* - `{boolean=}` - `upsert` - If `attrs` already contains a primary key, then attempt to call `DS.update` instead. Default: `true`.
38+
* - `{boolean=}` - `eagerInject` - Eagerly inject the attributes into the store without waiting for a successful response from the adapter. Default: `false`.
3839
* - `{function=}` - `beforeValidate` - Override the resource or global lifecycle hook.
3940
* - `{function=}` - `validate` - Override the resource or global lifecycle hook.
4041
* - `{function=}` - `afterValidate` - Override the resource or global lifecycle hook.
@@ -136,6 +137,12 @@ function create(resourceName, attrs, options) {
136137
} else {
137138
return DS.createInstance(resourceName, attrs, options);
138139
}
140+
})
141+
.catch(function (err) {
142+
if (options.eagerInject && options.cacheResponse) {
143+
DS.eject(resourceName, injected[definition.idAttribute], { notify: false });
144+
}
145+
return DS.$q.reject(err);
139146
});
140147
}
141148
} catch (err) {

src/datastore/async_methods/destroy.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ function errorPrefix(resourceName, id) {
3232
*
3333
* - `{function=}` - `beforeDestroy` - Override the resource or global lifecycle hook.
3434
* - `{function=}` - `afterDestroy` - Override the resource or global lifecycle hook.
35-
* - `{boolean=}` - `eagerInject` - If `true` eagerly eject the item from the store without waiting for the adapter's response, the item will be re-injected if the adapter operation fails. Default: `false`.
35+
* - `{boolean=}` - `eagerEject` - If `true` eagerly eject the item from the store without waiting for the adapter's response, the item will be re-injected if the adapter operation fails. Default: `false`.
3636
*
3737
* @returns {Promise} Promise produced by the `$q` service.
3838
*

0 commit comments

Comments
 (0)