title: AngularJS ng-options create range
body: <p>I am trying to create a select element that has a list of numbers 1 to pages where pages is a variable that is the number of pages I have. What i don't know how to do is to structure the ng-options expression so that it will give me the numbers I need. Here is what I have so far</p>
  
  <pre><code>&lt;select ng-model="page" ng-options="???"&gt;&lt;/select&gt;
  </code></pre>
  
  <p>what do I need to put in the ng-options expression in order for it to create my select like</p>
  
  <pre><code>&lt;select&gt;
      &lt;option value="1"&gt;1&lt;/option&gt;
      ...
      &lt;option value="35"&gt;35&lt;/option&gt;
  &lt;/select&gt;
  </code></pre>
  
  <p>do I need to create a function that returns an array of numbers and use it in there somehow or is there an easier way to do this?</p>
  
  <p>any help would be greatly appreciated.</p>
  
  <p>Thanks</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>After posting my question i figured out one way to do it by creating a function called Range in my controller that takes two numbers and returns an array with all the values in that range. </p>
  
  <pre><code>$scope.Range = function(start, end) {
      var result = [];
      for (var i = start; i &lt;= end; i++) {
          result.push(i);
      }
      return result;
  };
  </code></pre>
  
  <p>then in the HTML I did</p>
  
  <pre><code>&lt;select ng-name="page" ng-options="page for page in Range(1, pages)"&gt;&lt;/select&gt; 
  </code></pre>
  
  <p>Is this the simplest way to do this or is there a better way?</p>