I have an Angular 2 NgModule in an Ionic 2 mobile app defined like this:
@NgModule({ declarations: [ MyApp, HomePage, ], imports: [ IonicModule.forRoot(MyApp) ], bootstrap: [IonicApp], entryComponents: [ MyApp, HomePage, ], providers: [{provide: ErrorHandler, useClass: IonicErrorHandler}, VatRatesDbService] }) export class AppModule {}
and the service is defined as follows:
import { Injectable } from '@angular/core'; import * as PouchDB from 'pouchdb'; @Injectable() export class VatRatesDbService { private _db; private constructor() { this._db = new PouchDB('rates.db', { adapter: 'websql' }); } }
However, I get the following runtime error:
The typeof type VatRatesDbService cannot be assigned to the FactoryProvider type. The property 'provide' is missing in the type 'typeof VatRatesDbService' type.
source share