Boa tarde, Gabriel! Tudo bem? Minha aplicação está apontando o seguinte erro: Unexpected value 'HttpClient' imported by the module 'AppModule'. Please add a @NgModule annotation.
import { BrowserModule } from '@angular/platform-browser';
import { ErrorHandler, NgModule } from '@angular/core';
import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular';
import { SplashScreen } from '@ionic-native/splash-screen';
import { StatusBar } from '@ionic-native/status-bar';
import { MyApp } from './app.component';
import { HomePage } from '../pages/home/home';
import { HttpClientModule } from '@angular/common/http';
import { CarrosServiceProvider } from '../providers/carros-service/carros-service';
@NgModule({
declarations: [
MyApp,
HomePage
],
imports: [
BrowserModule,
HttpClientModule,
IonicModule.forRoot(MyApp)
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
HomePage
],
providers: [
StatusBar,
SplashScreen,
{provide: ErrorHandler, useClass: IonicErrorHandler},
CarrosServiceProvider
]
})
export class AppModule {}
import { Injectable } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { Carro } from '../../modelos/carro';
@Injectable()
export class CarrosServiceProvider {
constructor(private _http: HttpClient) {
}
lista() {
return this._http.get<Carro[]>('http://localhost:8080/api/carro/listaTodos');
}
}
Desde já agradeço seu suporte