@wanaisa wrote:
I’m having an issue right now since I’m still a newbie here in ionic firebase’s world. I don’t really know how to pass a list selected from a page into another page. Can somebody help me?
here is my firebase.service
import { Injectable } from '@angular/core'; import { AngularFirestore } from '@angular/fire/firestore'; import * as firebase from 'firebase/app'; import 'firebase/storage'; import { AngularFireAuth } from '@angular/fire/auth'; @Injectable({ providedIn: 'root' }) export class FirebaseService { constructor( public afs: AngularFirestore, public afAuth: AngularFireAuth) { } getStudent(){ return new Promise<any>((resolve, reject) => { this.afs.collection('/StudentList').snapshotChanges() .subscribe(snapshots => { resolve(snapshots) }) }) } getStudents(userKey){ return new Promise<any>((resolve, reject) => { return this.afs.collection('/StudentList').doc(userKey).snapshotChanges() .subscribe(snapshots => { resolve(snapshots) }) }) } }
and here is my studlist.html where I want to select a list
<ion-item *ngFor="let sList of items"> <ion-card (click)="selectStud(sList)" > <br> <p ion-text>Name : {{sList.payload.doc.data().name}}</p> <p ion-text >Matrix :{{sList.payload.doc.data().matrix}} </p> <p ion-text >Booth : {{sList.payload.doc.data().booth}}</p> <p ion-text >Not evaluated</p><br> </ion-card></ion-item>
inside studlist.ts, this the function that will be select and pass into another page
selectStud(sList){ this.navCtrl.navigateBack('/role');}
Posts: 4
Participants: 2