title: AngularJS: display a select box from JSON data retrieved by http GET (from REST service)
body: <p>I have a REST service that I made which returns a json string which is simply a set of strings (I used Gson to generate this string (Gson.toJson(mySetOfStrings))</p>
  
  <p>So I have added to my index.html:</p>
  
  <pre><code>&lt;div ng-controller="ListOptionsCtrl"&gt;
    &lt;form novalidate&gt;
      &lt;button ng-click="refreshList()"&gt;refresh&lt;/button&gt;
      &lt;select name="option" ng-model="form.option" ng-options="o.n for o in optionsList&gt;&lt;/select&gt;
    &lt;/form&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>and in my script:</p>
  
  <pre><code>var ListOptionsCtrl = function ListOptionsCtrl($scope, $http) {
    $scope.refreshList = function() {
      $http({ 
        method: 'GET'
        url: '*someurl*'
      }).
        success(function(data) {
          $scope.optionsList = angular.fromJson(data);
      });
    };
  }
  </code></pre>
  
  <p>Unfortunately all this produces in my select box is an empty list. When I see what the response to the GET request is it returns a json string with content in it so I do not see why nothing is being added to this element. What am I doing wrong here? thanks</p>