如果从对象加载数据而不是从数组加载数据,我如何从ng-options元素中获取键和值?
HTML:
<select ng-model="select" ng-options="value for (key, value) in brand"></select>
<pre>{{select}}</pre>
<!-- {{select.key}}, {{select.value}} -->
控制器:
$scope.brand = {
'a': 'alpha',
'b': 'bravo',
'c': 'charlie',
'd': 'delta'
};
提前感谢!