Angular Firebase检索数据

时间:2018-11-09 12:22:31

标签: javascript angular firebase firebase-realtime-database angularfire2

我在Firebase上有实时数据库。我正在尝试从节点中获取数据 下面是我的实时数据库Firebase的图像:-

enter image description here

我正在尝试通过以下代码将分类数据提取到我的Angular项目中:-

getCatagories()
  {
    console.log("The Data is",this.db.list('/catagories').valueChanges());
    return this.db.list('/catagories');
  }

但是当我将数据打印到控制台时,它将返回 像:-

enter image description here

我如何从实时Firebase数据库中检索数据并显示在html视图中

我将我的Package.json文件附加到角度项目:-

{
  "name": "freelance-project",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build --prod",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^5.2.0",
    "@angular/common": "^5.2.0",
    "@angular/compiler": "^5.2.0",
    "@angular/core": "^5.2.0",
    "@angular/forms": "^5.2.0",
    "@angular/http": "^5.2.0",
    "@angular/platform-browser": "^5.2.0",
    "@angular/platform-browser-dynamic": "^5.2.0",
    "@angular/router": "^5.2.0",
    "@ng-bootstrap/ng-bootstrap": "^2.0.0",
    "angularfire2": "^5.0.2",
    "bootstrap": "^4.0.0",
    "core-js": "^2.4.1",
    "firebase": "^5.5.5",
    "firebase-tools": "^2.0.0",
    "g": "^2.0.1",
    "rxjs": "^5.5.6",
    "zone.js": "^0.8.19"
  },
  "devDependencies": {
    "@angular/cli": "1.6.8",
    "@angular/compiler-cli": "^5.2.0",
    "@angular/language-service": "^5.2.0",
    "@types/jasmine": "~2.8.3",
    "@types/jasminewd2": "~2.0.2",
    "@types/node": "~6.0.60",
    "codelyzer": "^4.0.1",
    "jasmine-core": "~2.8.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~2.0.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "protractor": "~5.1.2",
    "ts-node": "~4.1.0",
    "tslint": "~5.9.1",
    "typescript": "~2.5.3"
  }
}

请帮助检索数据 预先谢谢你

0 个答案:

没有答案