Waiting for an answer from server on http request in Angular 2
I have a little problem with my Angular2 app. I want to get some data from server for my user login, but my code is going ahead and I have a lot of bugs with it. I want to wait for answer from server, then do something with my data. This is my code: import { Injectable } from '@angular/core'; import { Http, Response, Headers } from '@angular/http'; import { Observable } from 'rxjs/Rx'; import { User } from './user'; @Injectable() export class UserService { public usersTmp: Array<Object> = new Array<Object>(); public users: Array<User>; public user: User = new User(); public noteToSend;