使用angularjs navite select指令,模型绑定只是一种方式,而在ui-select中,这似乎总是双向绑定。
<ui-select ng-model="uiSelected.animal">
<ui-select-match>
<span ng-bind="$select.selected.name"></span>
</ui-select-match>
<ui-select-choices repeat="animal in (animals | filter: $select.search) track by $index">
<span ng-bind="animal.name"></span>
</ui-select-choices>
</ui-select>,这里是展示我的问题的柱塞: https://plnkr.co/edit/FkZsFcMrTveWjXR5HNyT?p=preview
我的问题:
如何使ui-select只对模型进行单向招标,以便当我更改选定的作用域模型时,它不会绑定到ui-select?如果我改头换面:我如何使ui-选择行为像角本机选择?
发布于 2016-05-12 11:10:47
您可能必须将一个$watch添加到动物/汽车中,并将所选对象保存在不同的$scope变量中。我看不出另一种方式,因为uiSelected引用了动物数组中的对象。
使用-选择事件:
on-select="onSelectCallback($item, $model)"发布于 2016-05-12 11:29:39
对此使用单向绑定,
{{::animal.name}}https://stackoverflow.com/questions/37185041
复制相似问题