【问题标题】:InvalidPipeArgument: '[object Object]' for pipe 'AsyncPipe' Help needed with processing json data | Angular5InvalidPipeArgument: '[object Object]' for pipe 'AsyncPipe' 处理 json 数据需要帮助 |角5
【发布时间】:2018-03-26 08:31:12
【问题描述】:

我的问题:

[我的项目源代码:https://github.com/LarsE343/AdvancedBan-Webinterface]

我有以下数据:

{
  "punishments": [
    {
      "calculation": null, 
      "end": "-1", 
      "id": 2, 
      "name": "partygirl3", 
      "operator": "Nintendonator_xp", 
      "punishmentType": "WARNING", 
      "reason": "test", 
      "start": "1520165103063", 
      "uuid": "d2ed075762504663bb67a73155d69269"
    }, 
    {
      "calculation": null, 
      "end": "1520196276893", 
      "id": 4, 
      "name": "partygirl3", 
      "operator": "Nintendonator_xp", 
      "punishmentType": "TEMP_MUTE", 
      "reason": "none", 
      "start": "1520178276926", 
      "uuid": "d2ed075762504663bb67a73155d69269"
    }, 
    {
      "calculation": null, 
      "end": "-1", 
      "id": 5, 
      "name": "tosh94", 
      "operator": "Nintendonator_xp", 
      "punishmentType": "WARNING", 
      "reason": "test", 
      "start": "1520180242009", 
      "uuid": "tosh94"
    }, 
    {
      "calculation": null, 
      "end": "-1", 
      "id": 6, 
      "name": "tosh94", 
      "operator": "Nintendonator_xp", 
      "punishmentType": "WARNING", 
      "reason": "test", 
      "start": "1520180567341", 
      "uuid": "tosh94"
    }, 
    {
      "calculation": null, 
      "end": "-1", 
      "id": 7, 
      "name": "tosh94", 
      "operator": "Nintendonator_xp", 
      "punishmentType": "BAN", 
      "reason": "test", 
      "start": "1520180606379", 
      "uuid": "tosh94"
    }, 
    {
      "calculation": null, 
      "end": "-1", 
      "id": 8, 
      "name": "partygirl3", 
      "operator": "Nintendonator_xp", 
      "punishmentType": "WARNING", 
      "reason": "Bitte \u00fcberdenke dein Verhalten", 
      "start": "1520181381607", 
      "uuid": "d2ed075762504663bb67a73155d69269"
    }
  ]
}

现在我想用 :*ngFor="let _postsArray | async 的惩罚将它放在一个表中

但我收到错误消息:InvalidPipeArgument: '[object Object]' for pipe 'AsyncPipe'

【问题讨论】:

    标签: javascript angular datatable


    【解决方案1】:

    您应该在数组上使用 ngFor,将您的 HTML 代码更改为,

    <table id="customers" *ngFor="let punishments of _postsArray.punishments | async">
    

    【讨论】:

    • 不,我得到了错误:TypeError: _co._postsArray 是未定义的;类型错误:_co._postsArray 未定义; _co._postsArray 未定义; InvalidPipeArgument: '[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]' for pipe 'AsyncPipe' 感谢您为这个好主意添加错误。你是在你的电脑上本地设置项目的吗??
    • 你已经订阅了this.punishmentService.getPunishments(),试试这个答案没有异步管道
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-10-28
    • 2019-03-25
    • 1970-01-01
    • 2018-05-11
    • 2021-01-02
    • 2017-12-05
    相关资源
    最近更新 更多