Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Issue while Fetching Data from Firebase on Mat Table

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 191
    Answer it

    i'm not able to fetch data from  firebase on mat table

    from component ts

    getAllStudent() {
    
    this.service.getAllStudent().subscribe((data: any)=>{
    
    console.log(data.payload)
    
    this.students = data.map((e: { payload: { doc: { id: any; data: () => any; }; }; }) => {
    
    return {
    
    $key:e.payload.doc.id,
    
    ...e.payload.doc.data()
    
    }as Student;
    
    });
    
    console.log(this.students);
    
    this.studentData = new MatTableDataSource(this.students)
    
    this.studentData.paginator = this.paginator;
    
    });
    
    }

     

    this form service

    getAllStudent() {
    
    let userid : any = '';
    
    userid = window.localStorage.getItem("userid")
    
    console.log(userid)
    
    return this.firestore.collection('School').doc(userid).snapshotChanges();
    
    }

     

 0 Answer(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: