我有一个问题因为我尝试使用'article'或'div'
错误:
message: 'Can't bind to 'ngForFor' since it isn't a known property of 'div'.'
message: 'Property binding ngForFor not used by any directive on an embedded template. Make sure that the property name is spelled correctly and all directives are listed in the "@NgModule.declarations".'
<section class='mycontainer'>
<article *ngFor="let numberStep for steps; let i = index"
[ngClass]="article + i">
<div class='line'></div>
<div class='circle'></div>
</article>
</section>
如何将* ngFor与分隔符一起使用?
抱歉我的英文。
答案 0 :(得分:2)
应该是
*ngFor="let numberStep of steps; let i = index;"
您还需要确保已将CommonModule导入该组件的模块,文章
答案 1 :(得分:1)
使用ngFor =“let numberStep of steps; let i = index”或ngFor =“let numberStep in steps; let i = index”
使用for * ngFor指令
时,你会犯错误