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
}
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.