0

I'm getting error and also data is not getting in Angular and ionic application using angularfire for firebase.

package.json :

"dependencies": {
    "@angular/common": "5.0.3",
    "@angular/compiler": "5.0.3",
    "@angular/compiler-cli": "5.0.3",
    "@angular/core": "5.0.3",
    "@angular/forms": "5.0.3",
    "@angular/http": "5.0.3",
    "@angular/platform-browser": "5.0.3",
    "@angular/platform-browser-dynamic": "5.0.3",
    "@ionic-native/core": "4.4.0",
    "@ionic-native/splash-screen": "4.4.0",
    "@ionic-native/status-bar": "4.4.0",
    "@ionic/pro": "1.0.16",
    "@ionic/storage": "2.1.3",
    "angularfire2": "^5.0.0-rc.1",
    "firebase": "^4.4.0",
    "ionic-angular": "3.9.2",
    "ionicons": "3.0.0",
    "rxjs": "5.5.2",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.18"
  },

service for firebase :

constructor(public afDB: AngularFireDatabase) {
    console.log('Hello FireBaseServicesProvider Provider');
  }

  getStockUserList(){
    // let getData = this.afDB.list().
    return this.afDB.list('stock/').valueChanges();
    // this.afDB.list('stock/');
  }

in page.ts file :

    stockList: Observable<any>;
this.stockList = this.fbService.getStockUserList();

in html :

<ul>
    <li *ngFor="let item of stockList | async">
      {{ item.age }}
    </li>
  </ul>

in firebase stock list is having name and age with the unique key . add is working but data getting from firebase having issue and also displaying "ngFor is only for array elements " and

typescript error
            Cannot find type definition file for 'firebase'.
1

1 Answer 1

1

Go back to firebase 4.8.0:

  • In your CLI with you project path type: npm uninstall firebase then once fish uninstall, type: npm cache clear
  • Then type: npm install firebase@^4.8.0
  • finally: Remove "firebase": "^5.0.0-rc.1" in dependencies in package.json and Type "firebase": "4.8.0"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.