使用mat-select

时间:2020-06-26 06:15:02

标签: typescript angular8

嗨,我想对下拉菜单应用过滤器,但是它什么也没做,每当我在搜索栏中输入任何关键字时,它就会显示此错误:ng:///AdminLayoutModule/DashboardComponent.ngfactory.js:123 ERROR TypeError: this.stateFileList.filter is not a constructor at DashboardComponent.push../src/app/dashboard/dashboard.component.ts.DashboardComponent.searchStateFileList (layouts-admin-layout-admin-layout-module.js:101649) at DashboardComponent.push../src/app/dashboard/dashboard.component.ts.DashboardComponent.onKeySearchStateFile (layouts-admin-layout-admin-layout-module.js:101644) at Object.eval [as handleEvent] (ng:///AdminLayoutModule/DashboardComponent.ngfactory.js:145) at handleEvent (vendor.js:79896) at callWithDebugContext (vendor.js:80990) at Object.debugHandleEvent [as handleEvent] (vendor.js:80693) at dispatchEvent (vendor.js:77345) at vendor.js:77792 at HTMLInputElement. (vendor.js:129159) at ZoneDelegate../node_modules/zone.js/dist/zone.js.ZoneDelegate.invokeTask (polyfills.js:17162)

我的html代码是:

我的component.ts代码是:

onKeySearchStateFile(value){

this.stateFileList = this.searchStateFileList(value);
this.stateFileList.filter(([k, v]) => v.toLowerCase().includes(value.toLowerCase()));
console.log(value);

}

searchStateFileList(值:字符串):数组{

return new Map(Array.from(this.stateFileList.filter(([k, v]) => v.toLowerCase().includes(value.toLowerCase()));

}

其中stateFileList:any;

我是angular的初学者,谢谢您的帮助。

0 个答案:

没有答案