Hi,
I have a grails rest api server. This returns data when I use curl.
I have used the angular 2 heroes application to display this data. This was 
working and then I added authentication and it stopped working. I have 
returned to the pre authentication set up and I still get the same errors.
I have logging on grails and I can see that it returns the data. But the 
data is not displayed within the browser.

I have switched on the browser debugging console. Network does not show any 
errors but the console shows quite a few. I must admit I do not really 
understand what is going wrong from this so hopefully someone can point me 
in the right direction.


"url is http://centos64:8080/heroes?max=15";

An error occurred Object { _body: error, status: 0, ok: false, statusText: 
"", headers: Object, type: 3, url: null }  

EXCEPTION: Uncaught (in promise): Response with status: 0  for URL: null  

ORIGINAL STACKTRACE:  vendor.bundle.js:59773:13

resolvePromise@http://localhost:4200/vendor.bundle.js:98058:31
resolvePromise@http://localhost:4200/vendor.bundle.js:98043:17
scheduleResolveOrReject/<@http://localhost:4200/vendor.bundle.js:98092:17
ZoneDelegate.prototype.invokeTask@http://localhost:4200/vendor.bundle.js:97855:21
NgZone.prototype.forkInnerZoneWithAngularBehavior/this.inner<.onInvokeTask@http://localhost:4200/vendor.bundle.js:31513:28
ZoneDelegate.prototype.invokeTask@http://localhost:4200/vendor.bundle.js:97854:21
Zone.prototype.runTask@http://localhost:4200/vendor.bundle.js:97744:28
drainMicroTaskQueue@http://localhost:4200/vendor.bundle.js:97991:25
ZoneTask/this.invoke@http://localhost:4200/vendor.bundle.js:97929:25
  vendor.bundle.js:59774:13

Unhandled Promise rejection: Object { _body: error, status: 0, ok: false, 
statusText: "", headers: Object, type: 3, url: null } ; Zone: angular ; 
Task: Promise.then ; Value: Object { _body: error, status: 0, ok: false, 
statusText: "", headers: Object, type: 3, url: null } undefined  
vendor.bundle.js:97978:13

Error: Uncaught (in promise): Response with status: 0  for URL: null
Stack trace:
resolvePromise@http://localhost:4200/vendor.bundle.js:98058:31
resolvePromise@http://localhost:4200/vendor.bundle.js:98043:17
scheduleResolveOrReject/<@http://localhost:4200/vendor.bundle.js:98092:17
ZoneDelegate.prototype.invokeTask@http://localhost:4200/vendor.bundle.js:97855:21
NgZone.prototype.forkInnerZoneWithAngularBehavior/this.inner<.onInvokeTask@http://localhost:4200/vendor.bundle.js:31513:28
ZoneDelegate.prototype.invokeTask@http://localhost:4200/vendor.bundle.js:97854:21
Zone.prototype.runTask@http://localhost:4200/vendor.bundle.js:97744:28
drainMicroTaskQueue@http://localhost:4200/vendor.bundle.js:97991:25
ZoneTask/this.invoke@http://localhost:4200/vendor.bundle.js:97929:25

Here is the code in the service module. Note that the second log message 
does not show.

  getHeroes(): Promise<Hero[]> {
  const url = `${this.heroesUrl}?max=15`;
  console.log("url is " + url)
    return this.http.get(url)
               .toPromise()
               .then(response => { console.log("response is " + 
response.json()); response.json() as Hero[] } )
               .catch(this.handleError);
  }
 

Regards,
John

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to