Service class does not recognize Angular 10 Httpclientmodule class methods

Asked

Viewed 42 times

0

That’s the structure of my little project;

inserir a descrição da imagem aqui

And be able to import the http module into my project as you can see below;

inserir a descrição da imagem aqui

But after importing the method into my service class it generates errors in the code because it does not recognize the method get as you can see below;

inserir a descrição da imagem aqui

I need help fixing this, I’m with the version of Angular 10 and I don’t understand why you’re making this mistake.

If I navigate directly to the Httpclientmodule class I can locate the method get who is not being recognized in my class of services, I wonder what went wrong

  • 2

    In the module you import the module import { HttpClientModule } , service vc uses the classes with the methods import { HttpClient }

  • Our dear, I would never imagine it to be that way, from angula 2 until the 10 changed some things and left me confused, thank you very much, can post your reply to me mark as correct.

  • 2

    I don’t think you need an answer for this no, until pq, even in version 2 is the same way, in the service you matter the class with the methods and in the module the modules!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.