User_3535
User_3535

Reputation: 852

angularjs ng-repeat not working in firebase

how to access items in firebase using angularjs I got how many rows in firebase but not the values

my code

<ul class="next-days" >
                <li ng-repeat="item in val">
                   {item.name}
                    <a href="#43">
                        <p class="next-days-date"><span class="day">{item.text}</span> <span class="scnd-font-color">{item.price}</span></p>
                        <p class="next-days-temperature">{item.quan}</p>
                    </a>
                </li>
            </ul>

and my app.js

var ref = new Firebase("https://qwertyuiop.firebaseio.com/values");
   $scope.val = $firebaseArray(ref);

plunker demo

Upvotes: 0

Views: 137

Answers (2)

Laxmikant Dange
Laxmikant Dange

Reputation: 7688

Angular needs double curly brackets to render value in view. You used only one curly bracket.

For ex.

Instead of {item.name} you need {{item.name}}

Here is plnkr.

Here is code

<ul class="next-days" >
  <li ng-repeat="item in val">
    {{item.name}}
    <a href="#43">
      <p class="next-days-date"><span class="day">{{item.text}}</span> <span class="scnd-font-color">{{item.price}}</span></p>
      <p class="next-days-temperature">{{item.quan}}</p>
    </a>
  </li>
</ul>

Upvotes: 1

Thomas Kekeisen
Thomas Kekeisen

Reputation: 4406

You are just missing a second { and }, so this works:

        <ul class="next-days" >
            <li ng-repeat="item in val">
               {{item.name}}
                <a href="#43">
                    <p class="next-days-date"><span class="day">{{item.text}</span> <span class="scnd-font-color">{{item.price}}</span></p>
                    <p class="next-days-temperature">{{item.quan}}</p>
                </a>
            </li>
        </ul>

Upvotes: 1

Related Questions