【问题标题】:why there is error in async pipe "InvalidPipeArgument: '[object Object],[object Object],' for pipe 'AsyncPipe'"?为什么异步管道“InvalidPipeArgument: '[object Object],[object Object],' for pipe 'AsyncPipe'”中有错误?
【发布时间】:2020-10-28 10:32:27
【问题描述】:

我正在尝试通过 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> &nbsp;
                <button class="btn btn-danger" (click)="deleteRow(recentDetails.id,i)">Delete</button>
              </td>
            </tr>
          </tbody>
        </table>

请帮帮我。 提前谢谢。

【问题讨论】:

    标签: html angular typescript bootstrap-4 ng-bootstrap


    【解决方案1】:

    听起来user$ 是一个对象数组,而不是一个对象数组的可观察对象。如果是这种情况,您可以删除| async,它应该可以正常工作。

    如果您需要 user$ 成为可观察对象,则必须重新检查您的 Typescript 代码。另外,如果您需要这方面的帮助,您也应该分享相关的 TS 代码 sn-ps。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-05-23
      • 1970-01-01
      • 2018-05-11
      • 2018-06-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多