How to display data in firebase using angularfire collection?

时间:2021-10-28 16:54:40

I have some data in firebase in the url "https://wpladv.firebaseio.com/adventure" and I have the following code in my js file:

我在网址“https://wpladv.firebaseio.com/adventure”中的firebase中有一些数据,我在我的js文件中有以下代码:

.factory('dataUpdate', ['angularFireCollection', function(angularFireCollection) {
  var dbUrl = 'https://wpladv.firebaseio.com/adventure';
  return {
    adventures: function(){
      var cat = '/adventure';
      return angularFireCollection(dbUrl + cat);
    }
  }
}])

I also have the following code in my HTML

我的HTML中也有以下代码

<ul class="unstyled">
  <li ng-repeat="adventure in adventures">
    <div class="well">
      <h4>{{adventure.name}}</h4>
      <h5><em>{{adventure.desc}}</em></h5>
      <p>{{adventure.theme}}</p>
      <p>{{adventure.like}}%</p>
      <p>Taken by {{adventure.used}}</p>
   </div>
  </li>
</ul>

The data in firebase is in JSON. My question is how do i display the data in the url using angularfire collection object? I am new to angularfire and any suggestion will be appreciated. Thanks in advance.

firebase中的数据是JSON。我的问题是如何使用angularfire收集对象在URL中显示数据?我是angularfire的新手,任何建议都将受到赞赏。提前致谢。

1 个解决方案

#1


2  

First, please do this really simple tutorial. It'll help you understand the basics of angular and firebase.

首先,请做这个非常简单的教程。它将帮助您了解角度和火力基础的基础知识。

You have to bind the firebase data to the target scope. This is usually done in the controller (see this specific step of the tutorial)

您必须将firebase数据绑定到目标范围。这通常在控制器中完成(参见教程的这个特定步骤)

#1


2  

First, please do this really simple tutorial. It'll help you understand the basics of angular and firebase.

首先,请做这个非常简单的教程。它将帮助您了解角度和火力基础的基础知识。

You have to bind the firebase data to the target scope. This is usually done in the controller (see this specific step of the tutorial)

您必须将firebase数据绑定到目标范围。这通常在控制器中完成(参见教程的这个特定步骤)