title: ANgularjs: ng-repeat and nested custom directive
body: <p>I am trying to ng-repeat a custom directive, which has an attribute that should change over the iteration.</p>
  
  <p>This is my html:</p>
  
  <pre><code>&lt;div ng-controller="WalletsController as controller"&gt;
      &lt;bitcoin-address ng-repeat="bitcoin_label in controller.getWallets()"  bitcoin-label="bitcoin_label"&gt;&lt;/bitcoin-address&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>This is my controller:</p>
  
  <pre><code>(function() {
  var app = angular.module('wallets', [ ]);
  
  app.controller(
          "WalletsController",
          function($scope, $http) {
              this.wallets = [];
  
              var controller = this;
  
              this.getWallets = function() {
                  return controller.wallets;
              };
  
              $http.get("wallet_addresses").success(
                      function(data) {
                          for (var i = 0; i &lt; data.length; i++) {
                              var curWallet = data[i];
                              $scope[curWallet.label] = {
                                  label: curWallet.label,
                                  address: curWallet.address,
                                  balance: curWallet.balance
                              };
                              controller.wallets.push(curWallet.label);
                          }
                      }
              );
          });
  
  app.directive(
          'bitcoinAddress',
          function() {
              return {
                  restrict: 'E',
                  templateUrl: '../../resources/html/bitcoin-address.html',
                  scope: {
                      bitcoinLabel: '=',
                  }
              };
          }
  );
  })();
  </code></pre>
  
  <p>And this is my template:</p>
  
  <pre><code>&lt;div class="col-md-8 dashboardAddressCell dropdown-toggle" data-toggle="dropdown"&gt;{{bitcoinLabel.address}}&lt;/div&gt;
  </code></pre>
  
  <p>What happens is that the template can not resolve the bitcoinLabel variable. I have tried specifying a constant value and the template works. My conclusion is that I am not correctly specifying the bitcoin_label attribute in the html section.I have also tried using {{bitcoin_address}}, but angularjs complains about that.</p>
  
  <p>I have also tried with the following html code:</p>
  
  <pre><code>&lt;div ng-controller="WalletsController as controller"&gt;
          &lt;!-- &lt;tr&gt;&lt;th&gt;Indirizzo&lt;/th&gt;&lt;th&gt;Saldo&lt;/th&gt;&lt;th&gt;&lt;/th&gt;--&gt;
          &lt;div ng-repeat="bitcoin_label in controller.getWallets()"&gt;
              {{bitcoin_label}}
              &lt;bitcoin-address bitcoin-label="bitcoin_label"&gt;&lt;/bitcoin-address&gt;
          &lt;/div&gt; 
          &lt;bitcoin-address  bitcoin-label="ciccio"&gt;&lt;/bitcoin-address&gt;
      &lt;/div&gt;
  </code></pre>
  
  <p>It does not work either, but at least it shows the {{bitcoin_label}} value.</p>