html - 为什么异步管道“InvalidPipeArgument: '[object Object],[object Object],' for pipe 'AsyncPipe'”中有错误?
问题描述
我正在尝试通过 ng-bootstrap 在表中应用搜索。但是异步管道中有一个错误 ="InvalidPipeArgument: '[object Object],[object Object],[object Object],[object Object],[object Object]' for pipe 'AsyncPipe'" 我已应用与显示在 ng-botstrap 网站上。
<table class="table table-striped">
<thead class="thead-dark">
<tr>
<th>S.No.</th>
<th>Name</th>
<th>Email</th>
<th>Date Of Birth</th>
<th>Contact Number</th>
<th>Image</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<tr *ngFor=" let recentDetails of user$ | async; index as i ">
<td >{{i+1+((tableModel.Page-1)*tableModel.pageSize)}}</td>
<td ><ngb-highlight [result]="recentDetails.name" [term]="filter.value"></ngb-highlight></td>
<td ><ngb-highlight [result]="recentDetails.email" [term]="filter.value"></ngb-highlight></td>
<td ><ngb-highlight [result]="recentDetails.dateOfBirth" [term]="filter.value"></ngb-highlight></td>
<td ><ngb-highlight [result]="recentDetails.contactNumber" [term]="filter.value"></ngb-highlight></td>
<td><img src="https://localhost:44342/Images/{{recentDetails.userImageGuid}}"></td>
<td> <button class="btn btn-warning" (click)="editUserDetails(recentDetails.email)">Edit</button>
<button class="btn btn-danger" (click)="deleteRow(recentDetails.id,i)">Delete</button>
</td>
</tr>
</tbody>
</table>
请帮帮我。提前谢谢。
解决方案
听起来像是user$
对象数组,而不是对象数组的可观察对象。如果是这种情况,您可以删除| async
并且无论如何它都应该工作。
如果你需要user$
成为一个 observable,你将不得不重新检查你的 Typescript 代码。此外,如果您需要这方面的帮助,您也应该分享相关的 TS 代码片段。
推荐阅读
- ios - 将 iOS 设备放在桌面上时出现奇怪的布局行为
- reactjs - 这个 Codesandbox Reactjs 应用 MainLayout 是如何工作的
- c# - 无法从 IEmote 获取 id
- node-red - Node-RED 高可用性/容错
- laravel - Laravel 8“不需要”验证规则
- objective-c - Typedef 不能用枚举说明符引用
- angular - 如何将选定的语言存储在 ngx-translate 中?
- asp.net-core - IdentityServer 4 WsFederation - 如何获取调用 API 的访问令牌
- r - 使用基本 R 函数构造函数创建闭包
- node.js - @mysql/xdevapi 不允许 WHERE field IN (?) 查询的数组参数