title: Custom directive to populate dynamic select box AngularJS
body: <p>I've got the following controller that basically calls a http get service and assigns the data to a <code>show_data</code> scope variable</p>
  
  <pre><code>.controller('forms_controller', function($scope, Form) {
  
  Form.get().then(function(data){
      $scope.show_data = data;
  });
  
  
  });
  </code></pre>
  
  <p>The <code>scope.show_data</code> is then pushed to this view ..</p>
  
  <pre><code>&lt;div ng-repeat="(key, value) in show_data | orderBy:'key' " &gt;
  &lt;div ng-switch on="value.Type" &gt;
      &lt;div ng-switch-when="attributes" &gt;
          &lt;div ng-repeat="(key2, value2) in value | orderBy:'key' "&gt;
  
              &lt;div ng-switch-when="Date" &gt;                            
                  &lt;label class="item item-input"&gt;
                      &lt;span class="input-label"&gt;{{value2.Label}}&lt;/span&gt;
                      &lt;input identifier="{{value2.Identifier}}" type="date"&gt;
                  &lt;/label&gt;
              &lt;/div&gt;
  
              &lt;div ng-switch-when="Select" &gt;
                  &lt;label class="item item-input item-select"&gt;
                      &lt;div class="input-label"&gt;
                      {{value2.Label}}
                      &lt;/div&gt;
                          &lt;select codelist="{{value2.CodeList}}" identifier="{{value2.Identifier}}" &gt;
                      &lt;/select&gt;
                  &lt;/label&gt;
              &lt;/div&gt;
  
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>
  </p>
  
  <p>Which basically checks the data based on the input type and spits out the different form elements based on the data. My problem is I am faced with is with the select box... Each select box has an id [codelist in this case] to the <code>ng-options</code> that should be displayed however, I'd first need to make another http get call to fetch this data before populating the ng-options ...<br>
  Please also note that there might be more then one select box per form.</p>
  
  <p>I was thinking of using some kind've custom directive to achieve this?<br>
  Any help would be highly appreciated :)<br>
  Thank You</p>