Skip to content

Commit

Permalink
Updating readme and spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenthedev committed Mar 12, 2016
1 parent 91b59f4 commit 1380e59
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# NOT READY!
# NOT READY! THE BELOW EXAMPLES ARE FOR END USE REFERENCE
## ng2-data
Conventional HTTP client for Model Data in Angular 2

Expand All @@ -11,11 +11,11 @@ import {Model, Type} from 'ng2-data';
exports Model.define('student', {
name: Type.string,
age: Type.number,
// classes: Type.has.many('courses'),
// school: Type.has.one('school'),
// nameAndAge: function (student) {
// return student.name + student.age;
// }
classes: Type.has.many('courses'),
school: Type.has.one('school'),
nameAndAge: function (student) {
return student.name + student.age;
}
});
```

Expand Down
13 changes: 7 additions & 6 deletions src/store.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {Http} from 'angular2/http';
import {StoreConfig} from './store.config';
import 'rxjs/Rx';

let instance = null;

@Injectable()
export class StoreService {
Expand Down Expand Up @@ -35,10 +36,10 @@ export class StoreService {
}

buildUri(model: string) {
return `${StoreService.config.baseUri}/${this.simplePluralize(model)}`
return `${StoreService.config.baseUri}/${this.simplePluralize(model) }`
}

makeRequest(method:string, uri:string, params:Object) {
makeRequest(method: string, uri: string, params: Object) {
return this.http[method](uri, params);
}

Expand All @@ -53,7 +54,7 @@ export class StoreService {
* GET /model/:id
*/
findOne(model: string, id: number) {
return this.http.get(`${this.buildUri(model)}/${id}`).map(r => r.json()[model]);
return this.http.get(`${this.buildUri(model) }/${id}`).map(r => r.json()[model]);
}

/**
Expand All @@ -68,16 +69,16 @@ export class StoreService {
/**
* PUT /model/:id
*/
update(model: string, id:number, body: Object) {
update(model: string, id: number, body: Object) {
let data = {};
data[model] = body;
return this.http.put(`${this.buildUri(model)}/${id}`, JSON.stringify(data)).map(r => r.json()[model]);
return this.http.put(`${this.buildUri(model) }/${id}`, JSON.stringify(data)).map(r => r.json()[model]);
}

/**
* DELETE /model/:id
*/
destroy(model: string, id: number) {
return this.http.delete(`${this.buildUri(model)}/${id}`).map(r => r.json());
return this.http.delete(`${this.buildUri(model) }/${id}`).map(r => r.json());
}
}

0 comments on commit 1380e59

Please sign in to comment.