You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Angular ngFor报错:Cannot convert object to primitive value 求助

问题:Angular ngFor 遍历对象时出现类型转换错误

我已导入一个含示例数据的JSON文件,希望基于其创建表格。使用OrderLineItems.ts接口类处理数据后,将该文件导入至Shopware Grid组件中,用console.log调试时功能正常。但在shopware-grid.component.html中尝试结合ngFor使用products属性时,出现如下转换错误:

core.mjs:6362 ERROR TypeError: Cannot convert object to primitive value
    at NgForOf.ngDoCheck (common.mjs:3200:87)
    at callHook (core.mjs:2504:18)
    at callHooks (core.mjs:2463:17)
    at executeInitAndCheckHooks (core.mjs:2414:9)
    at refreshView (core.mjs:11713:21)
    at refreshComponent (core.mjs:12793:13)
    at refreshChildComponents (core.mjs:11488:9)
    at refreshView (core.mjs:11748:13)
    at refreshComponent (core.mjs:12793:13)
    at refreshChildComponents (core.mjs:11488:9)

相关文件:

  • shopware-grid.component.ts
  • shopware-grid.component.html
  • 仓库:no-order-mgmt

内容的提问来源于stack exchange,提问作者NOrt

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.24 15:27:48