我想在Angular 2中使用多选,但是我还没有找到可以正常工作的多选。angular 2 s-multiselect-dropdown不能在表单元素内工作
ng2-complete
(不打电话的时候表单内onselect
功能)ss-multiselect-dropdown
(不叫ngModelChange
当表单内)angular2-multiselect
(表单内时不显示风格以及)
我需要使用表单元素,因为我想验证控件
s-multiselect-dropdown
MultiSelect和Filter模式也不起作用。
<form #f="ngForm" novalidate>
<ss-multiselect-dropdown [options]="paymentTypeInfo"
[ngModel]="selectedTexts" (ngModelChange)="onChange($event)" >
</ss-multiselect-dropdown>
<button type="submit" class="button"(click)=savePersonDetails(f.valid)>Submit</button>
<form/>
paymentTypeInfo: PaymentTypeInfo[] = [];
selectedTexts: number[] = [];
this.PaymentTypeInfo= [
{ "id": 1, "name": "India" },
{ "id": 2, "name": "Singapore" },
{ "id": 3, "name": "Australia" },
{ "id": 4, "name": "Canada" },
{ "id": 5, "name": "South Korea" },
{ "id": 6, "name": "Germany" },
{ "id": 7, "name": "France" },
{ "id": 8, "name": "Russia" },
{ "id": 9, "name": "Italy" },
{ "id": 10, "name": "Sweden" }
];
savePersonDetails(isValid: boolean) {
if (isValid)
{
console.log("selectedTexts");
console.log(this.selectedTexts);
}
}
public onChange(): void {
alert("hi");
console.log(this.selectedTexts);
}
请包含在产品ude您的html和角码 –
请分享您的代码 –
您关闭
而不是 –