-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Documentation improvements.
- Loading branch information
Showing
5 changed files
with
98 additions
and
58 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
@doc overview | ||
@id adapters | ||
@name Adapters | ||
@description | ||
|
||
Angular-data ships with a `DSHttpAdapter` and a `DSLocalStorageAdapter`. This is default adapter | ||
used for `DS.findAll`, `DS.update`, etc. | ||
|
||
Register a custom adapter: | ||
```js | ||
DS.adapters.myCustomAdapter = { ... }; | ||
``` | ||
|
||
Other available adapters: | ||
|
||
- [DSLocalForageAdapter](https://github.com/jmdobry/angular-data-localForage) | ||
|
||
The default adapter can be set globally: | ||
|
||
```js | ||
DSProvider.defaults.defaultAdapter = 'DSHttpAdapter'; | ||
``` | ||
|
||
per resource: | ||
|
||
```js | ||
DS.defineResource({ | ||
name: 'user', | ||
defaultAdapter: 'DSLocalForageAdapter' | ||
}); | ||
``` | ||
|
||
per method | ||
|
||
```js | ||
DS.update('post', 45, { author: 'Sally' }, { adapter: 'DSLocalForageAdapter' }); | ||
``` | ||
|
||
### Write Your Own Adapter | ||
|
||
For the data store to be able to use an adapter of yours, your adapter needs to implement the adapter API. Here it is: | ||
|
||
- `find` | ||
- `findAll` | ||
- `create` | ||
- `update` | ||
- `updateAll` | ||
- `destroy` | ||
- `destroyAll` | ||
|
||
Rather than repeat documentation here, you can find the method signatures and descriptions in the [DSHttpAdapter API](/documentation/api/angular-data/DSHttpAdapter.methods:find). | ||
|
||
The difference between the DSHttpAdapter and your adapter is that yours might not use HTTP, rather, it might interact with localStorage or indexedDb instead. | ||
|
||
You can post any questions on the [mailing list](https://groups.google.com/forum/?fromgroups#!forum/angular-data). |
This file was deleted.
Oops, something went wrong.
This file contains 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