Code QuizIntermediate Injecting HttpClient into a Service
Spot the import mistake that breaks HttpClient injection in an Angular service.
Codetypescript
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/http';
@Injectable({ providedIn: 'root' })
export class UserService {
constructor(private http: HttpClient) {}
getUsers() {
return this.http.get('/api/users');
}
}What is the bug in this code?