Getting data from firebase

HI,
I have a problem, I want to get data from database and it works. Next I want to put my objects into an array, but I get an error: Cannot read property ‘landmarks’ of undefined.

public landmarks;

And I initializing this in the constructor. Then

fun(){
this.LandmarkRef.once("value", function (snapshot) {
  snapshot.forEach(function (childSnapshot) {
    var newLandmark = childSnapshot.val();
    this.landmarks.push(new Landmark(newLandmark._id, newLandmark._latitude, newLandmark._longitude, newLandmark._title));
  })
 })
}

I want to use this array in different function. I have no idea, how to get data from database to array and use it later.

Try with angularfire2.
You can set landMarklist as FirebaseListObservable and then use it with async pipe.

public landMarks: FirebaseListObservable<any[]>;
constructor(public cat: Categories, public af: AngularFire) {
	this.landMarks = this.af.database.list('/events');
}

and then in html : <ion-item *ngFor="let landmark of landMarks | async">{{landmark._title}}<ion-item>