Skip to content

Commit a7085da

Browse files
committed
Add deleteRecord documentation
1 parent f131d2a commit a7085da

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

README.MD

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ A lightweight Angular 2 adapter for [JSON API](http://jsonapi.org/)
2121
- [Creating Records](#creating-records)
2222
- [Updating Records](#updating-records)
2323
- [Persisting Records](#persisting-records)
24+
- [Deleting Records](#deleting-records)
2425
- [Relationships](#relationships)
2526
- [Custom Headers](#custom-headers)
2627
- [TODO](#todo)
@@ -292,6 +293,15 @@ this.datastore.findRecord(Post, '1').subscribe(
292293
);
293294
```
294295

296+
#### Deleting Records
297+
298+
For deleting a record, just call the datastore's method `deleteRecord()`, passing the type and the id of the record:
299+
300+
```typescript
301+
this.datastore.deleteRecord(Post, '1').subscribe(() => {
302+
// deleted!
303+
});
304+
```
295305

296306
### Relationships
297307

@@ -394,7 +404,7 @@ post.save({}, new Headers({'Authorization': 'Bearer ' + accessToken})).subscribe
394404

395405

396406
## TODO
397-
- [ ] Deleting records
407+
- [x] Deleting records
398408
- [ ] Conversion to and from `Date` property
399409
- [ ] Handling validation errors
400410
- [ ] Updating or removing a relationship

0 commit comments

Comments
 (0)