ionic angular key value pair option list

ionic angular key value pair option list
ionic angular key value pair option list

ionic angular select option list example given for:

  • Create select with SQLite table row in AngularJS with ng-options
  • Create select with JSON in AngularJS with ng-options
  • ng-options default selected for edit form
  • ionic angular key value pair option list
  • javascript – key-value pairs in ng-options
  • Angularjs ng-options key value pairs
  • select ng-options examples
  • ng-options object array example
  • angularjs get selected option value
  • ionic ng-options

Controller

$scope.myOptionObj = [
    {id: '1', value: 'one'}
    {id: '2', value: 'two'}
    {id: '3', value: 'three'}
    ...
];

//For make option selected
$scope.myForm.myOpt = '2';

Template

<select name="myOpt"
id="myOpt" ng-model="myForm.myOpt"
ng-options="i.id as i.value for i in myOptionObj">
</select>