Skip to content Skip to sidebar Skip to footer

Uncaught (in Promise): Response With Status: 0 For Url: Null

I am trying to use the ionic framework and parse json from an API I created, then populate the html in my ionic app with it. When I go to my all-patients page I get the following

Solution 1:

I guess that obsidian age already gave you the possible core issue, but nevertheless you should handle promises rejection no matter what. So in that case you should change your code accordingly:

My all-patients.ts:

...
loadPeople(){
  this.restService.load()
  .then(data => {
    this.data = data;
  })
  .catch(e => console.error); // change this line according to your debugging/logging needs
}
...

rest-services.ts:

...
import'rxjs/add/operator/toPromise';
...
returnthis.http.get('url')
  .map(res => res.json())
  .subscribe(data => {
    this.data = data.results;
    returnthis.data
  })
  .toPromise();
...

Hopefully this clarifies the actual error that you reported but also give you more insight on what is going on as you won't be loosing any important information about the error(s).

Post a Comment for "Uncaught (in Promise): Response With Status: 0 For Url: Null"