1

使用 Angular 选择

https://github.com/localytics/angular-chosen

并测试以下示例

<select multiple
        chosen
        ng-model="state"
        ng-options="s.name for s in states">
  <option value=""></option>
</select>

但是,我想知道如何将状态对象的名称值绑定到 ng-model?

The options presented will display just the state names, but when chosen, the entire state object is bound to ng-model rather than just the selected name.

任何想法都会像往常一样受到欢迎!

4

1 回答 1

1

你可以试试这个格式

select as label for value in array

例如。s.name as s.name for s in states

于 2015-10-28T18:29:15.653 回答