Well, this is something weird, but I managed to fix it using a private method inside the service: where you place the method this.store.select(state => state.user), if you use import {Http} from "@angular/http";, make sure you do something next to this:
import {Injectable} from '@angular/core';
import {Http, Response} from "@angular/http";
import 'rxjs/add/operator/catch';
import 'rxjs/add/operator/map';
import {Observable} from "rxjs";
@Injectable()
export class MyService {
static get parameters() {
return [[Http]];
}
constructor(private http: Http) {
}
getList() {
var url = 'http://<URL_HERE>';
var response = this.http.get(url).map(this.extractData).catch(this.handleError);
console.log(response);
return response;
}
private extractData(res: Response) {
let body = res.json();
return body || { };
}
private handleError (error: any) {
let errMsg = (error.message) ? error.message :
error.status ? `${error.status} - ${error.statusText}` : 'Server error';
console.error(errMsg);
return Observable.throw(errMsg);
}
}
extractData, , , .