我有一个ui -选择,在用户按下保存按钮后,ui选择应该被重置为初始值。
ui-选择-
<ui-select multiple ng-model="selectedGroup" ng-change="selectGroups(selectedGroup)" style="width:250px;">
<ui-select-match placeholder="Select groups...">{{$item}}</ui-select-match>
<ui-select-choices repeat="group in groups| filter:$select.search">
{{group}}
</ui-select-choices>
</ui-select>在主计长中:
$scope.save = function(){
// some logic
$scope.selectedGroup = ["group1"];
}未更新ui选择的值。我怎么才能解决这个问题?
发布于 2015-07-19 03:05:46
ng-model在<ui-select>中必须有一个点(.)像这样的表情
<ui-select multiple ng-model="model.selectedGroup" ng-change="selectGroups(model.selectedGroup)" style="width:250px;">在控制器代码中,可以设置ng模型中指定的属性的初始值,如下所示
$scope.model = {
selectedGroup: ["group1"]
};https://stackoverflow.com/questions/31497524
复制相似问题