このエラーはなぜ発生しますか?IONIC 3: "エラー:コンポーネントファクトリが見つかりませんでした.... entryComponents?"
Error: No component factory found for DatabaseProvider. Did you add it to @NgModule.entryComponents?
プロバイダをentryComponentsに追加しようとしましたが、まだ機能しませんでした。私は、ローカルストレージを作るしようとしているが、私はこのプロバイダを使用することはできません。このプロバイダに
database.ts
import { HttpClient } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { Storage } from '@ionic/storage';
@Injectable()
export class DatabaseProvider {
localData: any;
constructor() {
console.log('Database provider iniciado ..');
}
}
マイ設定 、。
app.module.ts
import { NgModule, ErrorHandler } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { IonicApp, IonicModule, IonicErrorHandler } from 'ionic-angular';
import { MyApp } from './app.component';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import { DatabaseProvider } from '../providers/database/database';
import { IonicStorageModule } from '@ionic/storage';
@NgModule({
declarations: [
MyApp,
InicioPage,
SimuladorPage,
NosotrosPage,
CuestionarioPage,
CuestinarioPorCompetenciaPage,
PersonalizadoPage,
CRUDPage,
NormasPage,
CategoriasPage,
VerCategoriasPage,
PreguntasPage,
AlternativasPage,
FeedbackPage
],
imports: [
BrowserModule,
IonicModule.forRoot(DatabaseProvider),
IonicStorageModule.forRoot()
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
InicioPage,
SimuladorPage,
NosotrosPage,
CuestionarioPage,
CuestinarioPorCompetenciaPage,
PersonalizadoPage,
CRUDPage,
NormasPage,
CategoriasPage,
VerCategoriasPage,
PreguntasPage,
AlternativasPage,
FeedbackPage
],
providers: [
StatusBar,
SplashScreen,
{provide: ErrorHandler, useClass: IonicErrorHandler},
DatabaseProvider
]
})
export class AppModule {}