Angular 9 中的 *ngFor 问题,当我尝试在锚标记中使用它时,它显示 "No Directive is matched on attribute ngFor"
Issue in *ngFor in Angular 9,when I'm trying to use it in anchor tag it is showing that "No Directive is matched on attribute ngFor"
<a *ngFor="let recipe for recipes" href="#" class="list-group-item clearfix">
<div class="pull left">
<h4 class="list-group-item-heading">{{ recipe.name }}</h4>
<p class="list-group-item-text">{{ recipe.description }}</p>
<span class="pull-right">
<img src="" alt="{{recipe.name}}" class="img-responsive" style="max-height: 50px"/>
</span>
</div>
</a>
由于这条消息,我无法在此处使用 ngFor 指令
拼写错误:
而不是使用 let recipe for recipes
你应该使用 like :
<a *ngFor="let recipe of recipes" href="#" class="list-group-item clearfix">
<a *ngFor="let recipe for recipes" href="#" class="list-group-item clearfix">
<div class="pull left">
<h4 class="list-group-item-heading">{{ recipe.name }}</h4>
<p class="list-group-item-text">{{ recipe.description }}</p>
<span class="pull-right">
<img src="" alt="{{recipe.name}}" class="img-responsive" style="max-height: 50px"/>
</span>
</div>
</a>
由于这条消息,我无法在此处使用 ngFor 指令
拼写错误:
而不是使用 let recipe for recipes
你应该使用 like :
<a *ngFor="let recipe of recipes" href="#" class="list-group-item clearfix">