F
F
Fean0r2019-09-25 17:44:49
Angular
Fean0r, 2019-09-25 17:44:49

Angular 8. Why GET requests fail?

Any http request through Angular's HttpClient throws an error.
Everything is written, as in the documentation for HttpClient, requests through a separate Angular service, subscribe in the component, output to the console there.
Service code where requests:

getRequest() {
    return this.http.get<any>("[Любой url]");
}

Code in the component:
this.service.getRequest.subscribe(
      data => {
        console.log(data);
      },
      error => {
        console.log(error);
      }
    );

Error in console
5d8b7cbfb97ad531230096.png
All imports are in app.module.ts including
UPD :
5d8b84f046858416081773.png
Error in Chrome.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question