There are other answers that deal with using ng-option with an object formatted like so:
$scope.opts = [
{value: 111, text: '1st' },
{value: 222, text: '2nd' }
];
My question is, can it be done with an object formatted like this?
$scope.opts = [
{'111': '1st'},
{'222': '2nd'}
];
Trying it out doesn't work for me.
Any help?
To clarify:
I'd like the options to be like this <option value="111">1st</option
, etc, where the browser shows 1st
, and the model returns 111
. Can this be done with an array of simplified objects?