Skip to content

Commit

Permalink
Allow Http service to be injected in JsonApiDatastore - Closes #4
Browse files Browse the repository at this point in the history
  • Loading branch information
ghidoz committed Sep 2, 2016
1 parent 4b02c8a commit 1e567c5
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/services/json-api-datastore.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable, ReflectiveInjector } from '@angular/core';
import { Headers, Http, RequestOptions, HTTP_PROVIDERS } from '@angular/http';
import { Injectable } from '@angular/core';
import { Http, Headers, RequestOptions } from '@angular/http';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/map';
import 'rxjs/add/operator/catch';
Expand All @@ -8,13 +8,9 @@ import { JsonApiModel } from '../models/json-api.model';
@Injectable()
export class JsonApiDatastore {

private http: Http;
private _headers: Headers;

constructor() {
let injector = ReflectiveInjector.resolveAndCreate([HTTP_PROVIDERS]);
this.http = injector.get(Http);
}
constructor(private http: Http) { }

query(type: { new(data: any): JsonApiModel; }, params?: any, headers?: Headers): Observable<JsonApiModel[]> {
let options = this.getOptions(headers);
Expand Down

0 comments on commit 1e567c5

Please sign in to comment.