In the following example, we will once again provide the user with a set of options to order our results set. In this case, our order criteria options are sourced in an array. Depending on your use case, you may find the array fashion more practical than the object style. You should learn both.
Note: In order to iterate over this array, Angular provides us with a dsl expression we can use in the ng-options. In this case it will be ‘option.value as option.name for option in in optionsSet’. There are other available expressions:
- label for value in array
- select as label for value in array
- label group by group for value in array
- select as label group by group for value in array
For more information refer to AngularJS Docs: select