Variables in ng-repeat directive Angularjs

3

With the ng-repeat directive can I store two different variables?

Example:

ng-repeat="valor1 in valores1 & valor2 in valores2"

I have problems getting the key of my string in Firebase 3 and I want to extract the key . My code is as follows:

    var query = firebase.database().ref("path").orderByKey();
    query.once("value")
    .then(function(snapshot) {
      snapshot.forEach(function(childSnapshot) {
        var key = childSnapshot.key; console.log($scope.key);
        var childData = childSnapshot.val(); 
        $timeout(function() {
          $scope.coupons = snapshot.val();
        });
    });
  });
    
asked by Jean Manzo 23.11.2016 в 18:35
source

1 answer

2

Taking into account the ngRepeat documentation:   link

You are not allowed to use two collections in the ng-repeat directive, but what you can do is the following.

Coleccion1=Key;
Coleccion2=coins;

In this way, when you perform the ng-repeat on the collection1, you will be able to obtain information about the two collections, if they have any relationship with the key. To extract data from the second collection would be:

<div ng-repeat="item in Coleccion1>
  <h2>coleccion2[item.key].value</h2>
</div>

Another example: link

    
answered by 23.11.2016 / 19:41
source