I am trying to load a firebase outside of the pages so that any page can access the data without multiple requests using angularfire2.
I have created a class export which should load the database outside of pages however I am getting a runtime error:
Runtime Error
Can't resolve all parameters for FirebaseLoad: (?).
Here is the custom class export that is creating the error:
import { AngularFireDatabase, FirebaseListObservable } from 'angularfire2/database';
export class FirebaseLoad {
private items: FirebaseListObservable<any[]>;
constructor(afDB: AngularFireDatabase) {
this.items = afDB.list('/clubs');
}
getItems() {
return this.items;
}
}
Here is part of the app.module.ts file which is loading the custom class as a provider:
import { AngularFireModule } from 'angularfire2';
import { AngularFireDatabaseModule } from 'angularfire2/database';
import { FirebaseLoad } from '../app/firebaseLoad';
export const firebaseConfig = {
apiKey: "API_KEY",
authDomain: "AUTH_DOMAIN",
databaseURL: "DATABASE_URL",
storageBucket: "STORAGE_BUCKET",
messagingSenderId: "ID"
};
@NgModule({
declarations: [
MyApp,
HomePage,
MapPage,
ListPage,
TabsControllerPage
],
imports: [
BrowserModule,
IonicModule.forRoot(MyApp),
AngularFireModule.initializeApp(firebaseConfig),
AngularFireDatabaseModule,
],
bootstrap: [IonicApp],
entryComponents: [
MyApp,
HomePage,
MapPage,
ListPage,
TabsControllerPage
],
providers: [
StatusBar,
SplashScreen,
GoogleMaps,
Geolocation,
FirebaseLoad,
{provide: ErrorHandler, useClass: IonicErrorHandler}
]
})
export class AppModule {}