onInput(e){
this.inputValue = e.target.value;
}
onBlur(e){
this.mulobj.value = this.mulobj.value ? this.mulobj.value : [];
this.newValues = (this.mulobj.value as any).concat(this.inputValue);
this.mulobj.value = this.newValues;
this.inputValue = '';
}
|
// initialize MultiSelect component
let listObj: MultiSelect = new MultiSelect({
// set the placeholder to MultiSelect input element
placeholder: 'Favorite Sports',
// set the type of mode for how to visualized the selected items in input element.
mode: 'Box',
addTagOnBlur: true,
allowCustomValue: true,
});
listObj.appendTo('#box'); |