angular jasmin mock http response

Solutions on MaxInterview for angular jasmin mock http response by the best coders in the world

showing results for - "angular jasmin mock http response"
Natalia
27 Apr 2018
1 public static mockGetProfile(){
2    const response = JSON.parse(`
3     "name": "abc",
4     "active": true,
5     ...all other json fields that you want
6     `);
7
8    let obs = new Observable((subscriber) => {
9        setTimeout(()=>{
10            subscriber.next(response);
11            subscriber.complete();
12        }, 3000);
13    });
14    return obs;
15}