这里小提琴:http://jsfiddle.net/TU6tp/47/
我在这里得到如果我在下拉列表中选择任何选项我会在选择框文本中得到相同但我需要“更改投资组合”应该选择任何更改投资组合。
如果你看到小提琴,你会很容易理解我想说的话
CODE
<select
ng-model="selectedItem"
ng-options="o.label for o in selectables">
</select>
<p>Portfolio manager: {{selectedItem.value}}</p>
<p>Group: {{selectedItem.manager}}</p>
<p>Group name: {{selectedItem.groupname}}</p>
答案 0 :(得分:0)
您可以将ng-change
与两个范围变量selectedItemx
和selectedItem
<select
ng-model="selectedItemx"
ng-options="o.label for o in selectables" ng-change="changeLable()">
</select>
$scope.changeLable = function() {
$scope.selectedItem = $scope.selectedItemx;
$scope.selectables[0]['label'] = "CHANGE PORTFOLIO";
$scope.selectedItemx = $scope.selectables[0];
}
// this is the model that's used for the data binding in the select directive
// the default selected item
$scope.selectedItemx = $scope.selectables[0];