我正在拉对象数组作为$scope.templates
。我希望能够为我的ng-options数组中的选定选项设置$scope.item.steps
(我的选择型号名称)为template.steps
的值。有没有简单的方法来做到这一点,而无需添加额外的控制器逻辑?如何将ng-option模型设置为对象的值?
<select class="form-control" ng-options="template.name for template in templates" ng-model="item.steps">