Это мой файл app.module.ts
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 { HttpClient } from '@angular/common/http';
import { MyApp } from './app.component';
import { HomePage } from '../pages/home/home';
import { DataProvider } from '../providers/data/data';
@NgModule({
declarations: [
MyApp,
HomePage,
],
imports: [
BrowserModule,
HttpClient,
IonicModule.forRoot(MyApp)
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
HomePage
],
providers: [
StatusBar,
SplashScreen,
{provide: ErrorHandler, useClass: IonicErrorHandler},
DataProvider
]
})
export class AppModule {}
Я получаю сообщение об ошибке, подобное этому:
Uncaught Error: Unexpected value 'HttpClient' imported by the module
'AppModule'. Please add a @NgModule annotation.
at syntaxError (compiler.js:486)
at compiler.js:15240
at Array.forEach (<anonymous>)
at CompileMetadataResolver.getNgModuleMetadata (compiler.js:15215)
at JitCompiler._loadModules (compiler.js:34413)
at JitCompiler._compileModuleAndComponents (compiler.js:34374)
at JitCompiler.compileModuleAsync (compiler.js:34268)
at CompilerImpl.compileModuleAsync (platform-browser-dynamic.js:239)
at PlatformRef.bootstrapModule (core.js:5578)
at Object.199 (main.ts:5) syntaxError @ compiler.js:486 (anonymous) @ compiler.js:15240
CompileMetadataResolver.getNgModuleMetadata @ compiler.js:15215
JitCompiler._loadModules @ compiler.js:34413
JitCompiler._compileModuleAndComponents @ compiler.js:34374
JitCompiler.compileModuleAsync @ compiler.js:34268
CompilerImpl.compileModuleAsync @ platform-browser-dynamic.js:239
PlatformRef.bootstrapModule @ core.js:5578 199 @ main.ts:5
__webpack_require__ @ bootstrap c2d88ebb0bb27539f897:54 webpackJsonpCallback @ bootstrap c2d88ebb0bb27539f897:25 (anonymous) @
main.js:1