@Aurevoiiiir wrote:
Hi !
I’m starting to learn Ionic Framework with Firebase.
I have an a mobile app connected with Firebase.Datas are organized like this :
I’d like to display on my app a list of all “nomCat”
Here is my code and I don’t know how to get all the “nomCat” List
/*Provider*/ import { Injectable } from '@angular/core'; import firebase from "firebase"; @Injectable() export class MycartProvider { cart=[]; firedata2 = firebase.database().ref('/shops'); constructor() { console.log('Hello MycartProvider Provider'); } getCatdetails() { var promise = new Promise((resolve, reject) => { this.firedata2.child('/uidAuchan/uidCatFruits/').once('value', (snapshot) => { resolve(snapshot.val()); }).catch((err) => { reject(err); }) }) return promise; } }import {Component, NgZone} from '@angular/core'; import { IonicPage, NavController, NavParams } from 'ionic-angular'; import { MycartProvider } from '../../providers/mycart/mycart'; @IonicPage() @Component({ selector: 'page-cart-list', templateUrl: 'cart-list.html', }) export class CartListPage { displayCatName:string; constructor(public navCtrl: NavController, public navParams: NavParams, public cartProvider: MycartProvider, public zone: NgZone) { } loadCatdetails() { this.cartProvider.getCatdetails().then((res: any) => { this.displayCatName = res.nomCat; }) } ionViewWillEnter() { this.loadProddetails(); } }With this code, I get CatName, but only for 1 Cat =>
Thank you for reading, Can you help me please?
Posts: 4
Participants: 2
