Angular 无法在输出中获取定位标记值

Angular 无法在输出中获取定位标记值,angular,Angular,我在typescript文件中编写了json的锚定标记,条件是用html编写的。因此,我无法获取锚定标记值: {{item.description} 在.ts文件中,我编写了json: this.items=[{ “id:“9”,“href:”#9”,“className:”addBorder“,”title:“折扣是否适用于我当前的保险?”,“description:”否。这些是其他参与保险的保险公司提供的优惠,折扣仅适用于他们在没有您驾驶数据的情况下收取的保费。” }, { “id:“1

我在
typescript
文件中编写了
json
的锚定标记,条件是用
html
编写的。因此,我无法获取锚定标记值:


{{item.description}
在.ts文件中,我编写了json:

this.items=[{
“id:“9”,“href:”#9”,“className:”addBorder“,”title:“折扣是否适用于我当前的保险?”,“description:”否。这些是其他参与保险的保险公司提供的优惠,折扣仅适用于他们在没有您驾驶数据的情况下收取的保费。”
},
{
“id:“10”,“href:“#10”,“className:“addBorder折叠”,“title:“单击此处查看更多常见问题”,“说明”:”
},
]

items是一个数组,因此在HTML中引用索引时需要传递索引

<div id="{{item[0].id}}" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingOne">
  <div class="panel-body" style="padding-top: 0px;font-style: italic;padding-left: 30px;">
    {{item[0].description}}
  </div>
</div>

{{项[0]。说明}
或者像下面这样循环数组

<div *ngFor="let item of items">
  <div id="{{item.id}}" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingOne">
    <div class="panel-body" style="padding-top: 0px;font-style: italic;padding-left: 30px;">
      {{item.description}}
    </div>
  </div>
</div>

{{item.description}

如果愿意,只需为善良的读者做一点努力即可。