i got this method called openMapPage() that returns all the user key with reqdetails. Is any there way i can don’t use push page, but instead when i click on nearby button it just goes to openMapPage() and render’s all data to the request.html page?
request.html
<ion-header>
<ion-navbar color="primary">
<ion-title name="title">Job Requests</ion-title>
</ion-navbar>
</ion-header>
<ion-content padding>
<div class="filter">
<button class="islandwide" ion-button large>Islandwide</button>
<button class="nearby" ion-button large (click)="openMapPage()" id="nb">Nearby</button>
</div>
<ion-list>
<ion-card *ngFor="let user of request | async" class="job">
<button ion-item (click)="goToJobDetails(user.$key)" class="info">
<ion-avatar class="avatar" item-start>
<img src="../assets/icon/user_male-512.png">
</ion-avatar>
<h2 class="name">{{user.regdetails.username}}</h2>
<p text-wrap class="address"><ion-icon name="compass"></ion-icon> {{user.regdetails.address}}</p>
<p id="key">{{user.$key}}</p>
</button>
</ion-card>
</ion-list>
</ion-content>
openMapPage() method
openMapPage()
{
var ref = firebase.database().ref("request");
ref.once("value").then((snapshot) => { // <------ Here!
var a = snapshot.exists(); // true
var c = snapshot.hasChild("reqdetails"); // true
var d = snapshot.child('reqdetails').exists();
var requestsKey = snapshot.key;
var requestsValue = snapshot.val();
snapshot.forEach((childSnapshot) => { // <------ And here!
var requestKey = childSnapshot.key;
var requestValue = childSnapshot.val();
var reqdetails = requestValue.reqdetails;
if (reqdetails) {
this.data = requestKey;
console.log(this.data);
//this.arr.push(requestKey);
//console.log(this.arr);
}
});
this.navCtrl.push(RequestsPage, {
thing1: this.data
});
//this.navCtrl.push(RequestsPage, { 'param1': this.data });
});
}