Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript AngularJS如何取消选择组合框中的全部?_Javascript_Angularjs_Select - Fatal编程技术网

Javascript AngularJS如何取消选择组合框中的全部?

Javascript AngularJS如何取消选择组合框中的全部?,javascript,angularjs,select,Javascript,Angularjs,Select,好了,伙计们,我得到了这样的东西: <select style="width: 100px;" ng-disabled="true" ng-model="selectedStudent.accounts" size="5" ng-options="accounts.name for acount in selectedStudent.acco

好了,伙计们,我得到了这样的东西:

         <select style="width: 100px;"
                ng-disabled="true"
                ng-model="selectedStudent.accounts"  
                size="5"
                ng-options="accounts.name for acount in selectedStudent.accounts track by account.id"
         >
         </select>
现在我需要摆脱第一排…它根本不应该在那里。。。 不应该选择任何内容

有什么建议吗

以下是更多的数据:

    $scope.selectedStudent = {};
    $scope.selectedStudent = student;
学生:

他有身份证、姓名和银行账户

@OneToMany(cascade = { CascadeType.ALL})
private Set<BankAccount> accounts;

public Student() {
    accounts= new HashSet<BankAccount>();
}
@OneToMany(cascade={CascadeType.ALL})
私人账户;
公立学生(){
accounts=newhashset();
}
试试这个:-

angular.module('app',[])
.controller('controller',function($scope){
$scope.selectedStudent={};
$scope.selectedStudent.accounts={};
$scope.selectedStudent.accounts[0]={};
$scope.selectedStudent.accounts[0].name=“first”;
$scope.selectedStudent.accounts[0].id=1;
$scope.selectedStudent.accounts[1]={};
$scope.selectedStudent.accounts[1].name=“second”;
$scope.selectedStudent.accounts[1].id=2;
$scope.selected_account=$scope.selectedStudent.accounts[0].id;
})


您想要默认情况下选择选项之类的选项吗?不,我只想显示数据…所有内容都必须禁用。您可以共享selectedStudent的json格式。帐户请确认…我会将其添加到代码中什么是student??json格式?
@OneToMany(cascade = { CascadeType.ALL})
private Set<BankAccount> accounts;

public Student() {
    accounts= new HashSet<BankAccount>();
}