Удалите ngModel и попробуйте. Вы можете проверить рабочий код здесь
app.component. html
<form >
<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.email" >
{{field.userName}}</option>
</select>
</div>
</form>
app.component.ts
import { Component } from "@angular/core";
import { FormBuilder, FormGroup, Validators } from "@angular/forms";
import { CurrencyPipe, DatePipe } from "@angular/common";
declare var $;
@Component({
selector: "my-app",
templateUrl: "./app.component.html",
styleUrls: ["./app.component.css"]
})
export class AppComponent {
user: any = [
{
id: 1,
userName: "user",
email: "email1@gmail.com"
},
{ id: 2, userName: "user2", email: "email2@gmail.com" },
{ id: 3, userName: "uyuuy", email: "email3@gmail.com" },
{ id: 2, userName: "user2", email: "email4@gmail.com" }
];
public eoInfoForm: FormGroup;
selectedUsers: any;
constructor(private FB: FormBuilder) {}
ngOnInit() {
this.initEoForm();
setTimeout(() => {
$("#multiselectUser")
.multiselect({
buttonWidth: "400px"
})
.on("change", e => {
var selectedUser = $("#multiselectUser").val();
console.log(selectedUser, "selectedUser");
});
}, 100);
}
initEoForm() {
//Add
this.eoInfoForm = this.FB.group({
effectiveDate: ["", Validators.required]
});
}
selecteduser(event) {
alert(this.selectedUsers);
}
}
Я могу добавить и выделить все.