Skip to content

Commit 3b0e4bc

Browse files
committed
Stable Version 0.9.0.
Documentation improvements.
1 parent 2321073 commit 3b0e4bc

File tree

5 files changed

+98
-58
lines changed

5 files changed

+98
-58
lines changed

CHANGELOG.md

+37-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,45 @@
11
##### 0.9.0 - xx May 2014
22

3-
###### Breading API changes
3+
###### Breaking API changes
44
- #61 - Make custom serializers/deserializers more valuable
55
- #59, #62 - Make queryTransform() consistent with the rest of the API
66

7+
__Before:__
8+
9+
```js
10+
DSHttpAdapterProvider.defaults.serialize = function (data) { ... };
11+
```
12+
13+
__After:__
14+
15+
```js
16+
DSProvider.defaults.serialize = function (resourceName, data) { ... };
17+
```
18+
19+
__Before:__
20+
21+
```js
22+
DSHttpAdapterProvider.defaults.deserialize = function (data) { ... };
23+
```
24+
25+
__After:__
26+
27+
```js
28+
DSProvider.defaults.deserialize = function (resourceName, data) { ... };
29+
```
30+
31+
__Before:__
32+
33+
```js
34+
DSHttpAdapterProvider.defaults.queryTransform = function (query) { ... };
35+
```
36+
37+
__After:__
38+
39+
```js
40+
DSHttpAdapterProvider.defaults.queryTransform = function (resourceName, query) { ... };
41+
```
42+
743
###### Backwards compatible API changes
844
- #30, #48, #66 - DSCacheFactory integration
945
- #49 - DS.bindOne($scope, prop, resourceName, id)

Gruntfile.js

+3-10
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,7 @@ module.exports = function (grunt) {
239239
'guide/angular-data/asynchronous.doc',
240240
'guide/angular-data/synchronous.doc',
241241
'guide/angular-data/queries.doc',
242+
'guide/angular-data/adapters.doc',
242243
'guide/angular-data/how.doc'
243244
],
244245
rank: {
@@ -248,7 +249,8 @@ module.exports = function (grunt) {
248249
asynchronous: 4,
249250
synchronous: 5,
250251
queries: 6,
251-
how: 7
252+
adapters: 7,
253+
how: 8
252254
}
253255
},
254256
{
@@ -286,15 +288,6 @@ module.exports = function (grunt) {
286288
lifecycle: 5,
287289
custom: 6
288290
}
289-
},
290-
{
291-
id: 'angular-data-adapters',
292-
title: 'Adapters',
293-
docs: ['guide/angular-data/adapters/'],
294-
rank: {
295-
index: 1,
296-
overview: 2
297-
}
298291
}
299292
]
300293
},

guide/angular-data/adapters.doc

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
@doc overview
2+
@id adapters
3+
@name Adapters
4+
@description
5+
6+
Angular-data ships with a `DSHttpAdapter` and a `DSLocalStorageAdapter`. This is default adapter
7+
used for `DS.findAll`, `DS.update`, etc.
8+
9+
Register a custom adapter:
10+
```js
11+
DS.adapters.myCustomAdapter = { ... };
12+
```
13+
14+
Other available adapters:
15+
16+
- [DSLocalForageAdapter](https://github.com/jmdobry/angular-data-localForage)
17+
18+
The default adapter can be set globally:
19+
20+
```js
21+
DSProvider.defaults.defaultAdapter = 'DSHttpAdapter';
22+
```
23+
24+
per resource:
25+
26+
```js
27+
DS.defineResource({
28+
name: 'user',
29+
defaultAdapter: 'DSLocalForageAdapter'
30+
});
31+
```
32+
33+
per method
34+
35+
```js
36+
DS.update('post', 45, { author: 'Sally' }, { adapter: 'DSLocalForageAdapter' });
37+
```
38+
39+
### Write Your Own Adapter
40+
41+
For the data store to be able to use an adapter of yours, your adapter needs to implement the adapter API. Here it is:
42+
43+
- `find`
44+
- `findAll`
45+
- `create`
46+
- `update`
47+
- `updateAll`
48+
- `destroy`
49+
- `destroyAll`
50+
51+
Rather than repeat documentation here, you can find the method signatures and descriptions in the [DSHttpAdapter API](/documentation/api/angular-data/DSHttpAdapter.methods:find).
52+
53+
The difference between the DSHttpAdapter and your adapter is that yours might not use HTTP, rather, it might interact with localStorage or indexedDb instead.
54+
55+
You can post any questions on the [mailing list](https://groups.google.com/forum/?fromgroups#!forum/angular-data).

guide/angular-data/adapters/adapters.doc

-47
This file was deleted.

guide/nav.html

+3
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@
3737
<li>
3838
<a href="/documentation/guide/angular-data/queries">Queries & Filtering</a>
3939
</li>
40+
<li>
41+
<a href="/documentation/guide/angular-data/adapters">Adapters</a>
42+
</li>
4043
<li>
4144
<a href="/documentation/guide/angular-data/how">How do I...?</a>
4245
</li>

0 commit comments

Comments
 (0)