I have some troubles using Observable. I did it as I did on another project where there's no problem, and here my Observable only returns simple objects instead of the one I declare in the response type of my function.
I have this in my service :
postLogin(login: string, credential: string): Observable<AuthToken> {
let headers = new Headers({ "Content-Type": "application/json" })
let jsonLogin = {"login": login, "password": credential}
return this._apiEndpoint.postLogin(JSON.stringify(jsonLogin), headers)
.map(res => res.json())
}
Note that if I console.log my res.json(), I have all the fields I need for my AuthToken model.
If I console.log my returned variable in my component, I have it as Object with all the fields from the backend (if I remove or add some, they're there too). If I map manually all the fields as in here it sure works, but I used to have Observable doing it automatically.
Do you know what could be wrong ? Thanks !