我正在使用angular-2-dropdown-multiselect。
我从后端获取值列表。我只想将它们与ss-multiselect-dropdown绑定,并在下拉列表中将其显示为自动选择。
这是我的HTML
<ss-multiselect-dropdown
name="multiselect"
[texts]="myTexts"
[settings]="mySettings"
[options]="myOptions"
[(ngModel)]="myOptions"
formControlName="agent"
>
</ss-multiselect-dropdown>
这些文件位于.ts文件中
myOptions: IMultiSelectOption[] = [];
mySettings: IMultiSelectSettings = {
enableSearch: true,
checkedStyle: 'fontawesome',
buttonClasses: 'btn btn-primary btn-block',
dynamicTitleMaxItems: 3,
displayAllSelectedText: true
};
myTexts: IMultiSelectTexts = {
checkAll: 'Select all',
uncheckAll: 'Unselect all',
checked: 'item selected',
checkedPlural: 'items selected',
searchPlaceholder: 'Find',
searchEmptyResult: 'Nothing found...',
searchNoRenderText: 'Type in search box to see results...',
defaultTitle: 'Select',
allSelected: 'All selected'
};