How to create an observable in Ionic v2

Observable.create(observer => {
  this.http.get(url, {headers}).subscribe(res => {
      this.response = res;
      observer.next(this.response);
      observer.complete();
    },
    err => {
      console.log(err);
      observer.error(err);
      observer.complete();
    });
});

You may also like...

Leave a Reply