angular - 我收到错误 TS2339:任何类型 [] 上不存在属性“总计”
问题描述
这是片段。请帮我解决一下这个。
response: any[] = [];
proResponse: any[] = [];
erase(res: any[]): void {res.length = 0; this.response.total = 0; }
onSubmit(searchForm: FormGroup) {
this.showNhide = true;
this.proResponse = [];
this.proName = '';
this.searchService.searchNResult(searchForm.value).subscribe((result: any[]) => {
console.log('Result comes' + result.toString());
this.response = result;
}, (error: any) => {
console.log('search result Loading Error :' + error);
});
}
解决方案
它应该是any
not的响应类型。any[]
它应该如下,
this.searchService.searchNResult(searchForm.value).subscribe((result: any) => {
console.log('Result comes' + result.toString());
this.response = result;
}, (error: any) => {
console.log('search result Loading Error :' + error);
});
推荐阅读
- c# - 带有 MVC 视图的 Shopify 公共应用程序不起作用
- excel - 如何使用 HYPERLINK 函数在 Excel 中展开/折叠数据组
- mysql - 无法删除或更新父行:外键约束失败。MagicDraw 表格错误
- c++ - 我无法创建返回 unique_ptr 的函数的函数指针
- docker - 如何从 .net 核心重新启动 docker 容器
- python - 当前一个值为负时,熊猫重置 cumsum
- python-3.x - 如何从 faust 应用程序向 Websocket 发送数据
- c# - 基于单选按钮选择验证文本框
- laravel - 尝试在 AWS EC2 中托管 laravel 5.7 应用程序
- html - 如何使图像适合其 div CSS