I am trying to use ng-multiselect-dropdown
in my angular app.
I am getting this error is VSCode when I am defining the settings:
'IDropdownSettings' only refers to a type, but is being used as a value here.ts(2693)
I have imported the module using npm i ng-multiselect-dropdown
and I have defined in app.module.ts
. I was following the guide here.
I this how my settings look in my page.component.ts
:
import { IDropdownSettings } from 'ng-multiselect-dropdown'
export class VQCComponent implements OnInit {
dropdownSettings = {};
ngOnInit() {
this.dropdownSettings:IDropdownSettings = {
singleSelection: false,
idField: 'item_id',
textField: 'item_text',
selectAllText: 'Select All',
unSelectAllText: 'Unselect All',
itemsShowLimit: 3,
allowSeachFilter: true
}
}
}
The error is being highlighted on this line:
this.dropdownSettings:IDropdownSettings = {
What is causing this error? I have followed the guide, and I cannot seem to find any other documentation on this module.
typing a variable is only possible at declaration:
export class VQCComponent implements OnInit {
dropdownSettings:IDropdownSettings;
ngOnInit() {
this.dropdownSettings = {
singleSelection: false,
idField: 'item_id',
textField: 'item_text',
selectAllText: 'Select All',
unSelectAllText: 'Unselect All',
itemsShowLimit: 3,
allowSeachFilter: true
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With