Подключен Firebase, но не может использовать его в разных файлах. Нужно знать, как я могу получить к нему доступ и отобразить содержимое firebase.
файловая система: src -> app -> home
app module.ts:
export class AppModule {}
var config = {
apiKey: "AIzaSyBvJ0ZWfd2GcIpKgdcIaZKJ6ohLW_E7DOs",
authDomain: "fir-storage-login.firebaseapp.com",
databaseURL: "https://fir-storage-login.firebaseio.com",
projectId: "firebase-storage-login",
storageBucket: "firebase-storage-login.appspot.com",
messagingSenderId: "803036592201"
};
var app = firebase.initializeApp(config);
var database = firebase.database(app);
home.page.html
<ion-content>
<ion-searchbar (ionInput)="getStations($event)"></ion-searchbar>
<ion-list>
<ion-item *ngFor="let station of stations">
{{ station }}
</ion-item>
</ion-list>
</ion-content>
home.page.ts
import * as firebase from 'firebase/app';
import { AppModule } from '../app.module';
states: Array<any>;
initializeStates(){
return firebase.database().ref('States').once('value').then(snapshot =`>
snapshot.val());{
this.states }