Question · Angular course · Module 9: HttpClient

Injecting HttpClient

In modern Angular 19, how do we most commonly obtain an HttpClient instance in a service?

Answer options

  • const http = inject(HttpClient)
  • import HttpClient directly as a value
  • new HttpClient()
  • HttpClient.getInstance()

You can check the correct answer by solving this task in the CodeWorlds game.