複数選択で再生するplunkerを作成しました。
//our root app component
import {Component, NgModule, VERSION} from '@angular/core'
import {BrowserModule} from '@angular/platform-browser'
import {Component} from '@angular/core';
import { IMultiSelectSettings, IMultiSelectTexts } from 'angular-2-dropdown-multiselect/src/multiselect-dropdown';
import { MultiselectDropdownModule} from 'angular-2-dropdown-multiselect';
import { FormsModule } from '@angular/forms';
@Component({
selector: 'my-app',
template: `
<ss-multiselect-dropdown [options]="myOptions" [texts]="myTexts" [settings]="mySettings" [(ngModel)]="optionsModel"></ss-multiselect-dropdown>
`,
})
export class App {
optionsModel: number[] = [ 2, 3];
// Settings configuration
mySettings: IMultiSelectSettings = {
enableSearch: true,
checkedStyle: 'fontawesome',
buttonClasses: 'btn btn-default btn-block',
dynamicTitleMaxItems: 3,
displayAllSelectedText: true
};
// Text configuration
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',
};
// Options
myOptions: IMultiSelectOption[] = [
{ id: 1, name: 'Volvo'},
{ id: 2, name: 'Honda'},
{ id: 3, name: 'BMW'},
{ id: 4, name: 'Audi'},
];
}
@NgModule({
imports: [ BrowserModule,MultiselectDropdownModule, FormsModule ],
declarations: [ App ],
bootstrap: [ App ]
})
export class AppModule {}
詳細はhereを参照してください。
試したことがあるコードを表示してください。 –