简体   繁体   English

Bootstrap 4 Accordian与angular4中的ngFor?

[英]Bootstrap 4 accordian with ngFor in angular4?

<div id="accordion" role="tablist" aria-multiselectable="true" *ngFor="customeOffer of customOfferData">
        <div class="card">
              <div class="card-header" role="tab" id="headingThree">
                <h5 class="mb-0">
                 {{customeOffer.name}}
               </h5>
           </div>
      </div>
</div>

My accordian with ngFor is not working .It is giving error.Can anyone tell me.Please help .Thank in advance. 我的ngFor手风琴无法正常工作。它给出了错误。任何人都可以告诉我。请帮助。谢谢。

The syntax of ngFor loop is *ngFor ="let variable of array". ngFor循环的语法为* ngFor =“ let变量array”。

So in your case,the syntax will be like this: 因此,在您的情况下,语法将如下所示:

*ngFor="let customeOffer of customOfferData"

As you have mentioned, your ngFor is not working, and if you are getting this error, 如前所述,您的ngFor无法正常工作,如果遇到此错误,

Template parse errors: Can't bind to 'ngFor' since it isn't a known property of element 模板解析错误:由于它不是element的已知属性,因此无法绑定到ngFor

The issue is: *ngFor="customeOffer of customOfferData" 问题是: *ngFor="customeOffer of customOfferData"

You missed let keyword *ngFor="let customeOffer of customOfferData" 您错过了let关键字*ngFor="let customeOffer of customOfferData"

Reference: Showing an array property with *ngFor 参考: 使用* ngFor显示数组属性

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM