如下这段代码,as是什么意思?
ng-options="option.id as option.title for option in curOptionArray"
大家讲道理2017-05-15 17:04:25
option.id means selected,
option.title means displayed,
as is for this purpose
伊谢尔伦2017-05-15 17:04:25
It can be understood as an ng syntax option.id is the value submitted by select option.title is the value displayed by select option represents the current element in the array curOptionArray
迷茫2017-05-15 17:04:25
Please refer to the official website:
https://docs.angularjs.org/api/ng/directive/ngOptions#!
There is an example:
$scope.items = [{
id: 1,
label: 'aLabel',
subItem: { name: 'aSubItem' }
}, {
id: 2,
label: 'bLabel',
subItem: { name: 'bSubItem' }
}];
<select ng-options="item as item.label for item in items track by item.id" ng-model="selected"></select>
PHPz2017-05-15 17:04:25
You can check out Hacking with Angular: Playing with the ngOptions directive