【问题标题】:Data is not displaying in Angular2 App from firebase数据未显示在来自 firebase 的 Angular2 应用程序中
【发布时间】:2017-11-30 08:01:06
【问题描述】:

我在 Stackblitz 编辑器上链接了我的 angular 2 应用程序。已成功链接,但数据既未显示在控制台中,也未显示在浏览器中。请帮助我如何使用 angularfire2 最新版本显示数据。

https://stackblitz.com/edit/firebasedemo-angunv?file=app%2Fapp.component.ts

【问题讨论】:

    标签: angular firebase angularfire2


    【解决方案1】:

    你在html中做错了

    试试这个

    <ul>
        <li *ngFor="let course of items | async">
          {{course}}
        </li>
    </ul>
    

    您正在获取异步数据,以控制台记录您需要订阅的数据

    this.items.subscribe(courses => {
        courses.forEach(course => {
            console.log(course);
        }
    });
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-08-06
      • 2017-02-25
      • 2022-10-09
      • 1970-01-01
      • 1970-01-01
      • 2018-08-30
      • 2020-06-25
      • 1970-01-01
      相关资源
      最近更新 更多