[英]How to get multi select dropdown selected value in angular2
Hi i have used Angular8 and bootstrap 4. I have used bootstrap multi-select dropdown, i need to get the selected dropdown values.嗨,我用过 Angular8 和 bootstrap 4。我用过 bootstrap 多选下拉菜单,我需要获取选定的下拉菜单值。 How can i get those values.
我怎样才能得到这些值。
TS: TS:
setTimeout(() => {
$('#multiselectFileName').multiselect({
buttonWidth: '400px'
});
$('#multiselectUser').multiselect({
buttonWidth: '400px'
});
},100)
HTML: HTML:
<div class="form-group">
<label for="">Select User</label>
<select name="user" id="multiselectUser" multiple="multiple" (change)="selecteduser($event)">
<option *ngFor="let field of user" [value]="field.id" >
{{field.userName}}</option>
</select>
</div>
For me, it's simular to this question , try to use [(ngModel)] to bind a variable of your component (ts file) in your select tag to see what happens, and also use console.log() or debug mode to view the value of the variable binding to [(ngModel)] For example:对我来说,这与这个问题很相似,尝试使用 [(ngModel)] 在 select 标签中绑定组件的变量(ts 文件)以查看会发生什么,也可以使用 console.log() 或调试模式查看绑定到 [(ngModel)] 的变量的值 例如:
<select [(ngModel)]="selectedUsers" name="user" id="multiselectUser" multiple="multiple" (change)="selecteduser($event)">
<option *ngFor="let field of user" [value]="field.id" >
{{field.userName}}</option>
</select>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.