Search code examples
angularangular-directive

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>

I am not able to use ngFor directive here, due to this message


Solution

  • typo error :

    instead of using let recipe for recipes you should use like :

    <a *ngFor="let recipe of recipes" href="#" class="list-group-item clearfix">