#Why is HttpClient service not declared in Providers array as other services ?
5 messages · Page 1 of 1 (latest)
You include the HttpClientModule
Yeah can u explain a bit more in detail pls , I am new to angular
HttpClientModule does the setup for you
@worthy stratus most services are meant to be singletons (one instance in the whole application). There are provided with the Injectable metadata:
@Injectable({
providedIn: 'root'
})
By doing so, you don't need to declare services in the providers array. If you are still using the providers array, either you are on an ancient version of Angular or with practices based on a old documentation/blog post.