Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

128
Visualizações
ngFor gives an error even tho I have already imported BrowserModule, and CommonModule

Error: Property binding ngForOf not used by any directive on an embedded template Error especifically occurs because of the * in ngFor. If I take out the '*' and just put 'ngFor', I get an error 'Identifier 'recipe' is not defined.' 'recipes' is a class member variable in my TS file.

This is my html code:

<a href="#" class="list-group-item clearfix" *ngFor="let recipe of recipes">
            <div class="pull-left">
                <h4 class="list-group-item-heading">{{ recipe.name }}</h4>
                <p class="list-group-item-text">{{ recipe.description }}</p>
            </div>
</a>

This is what I have in my TS file:

export class RecipeListComponent implements OnInit {
  recipes: Recipe[] = [
    new Recipe(
      'A Test Recipe',
      'this is simply a test',
      'https://delightfuladventures.com/wp-content/uploads/2019/10/vegan-stuffed-sweet-potatoes-recipe.jpg'
    ),
    new Recipe(
      'A Test Recipe 2',
      'this is simply a test',
      'https://delightfuladventures.com/wp-content/uploads/2019/10/vegan-stuffed-sweet-potatoes-recipe.jpg'
    ),
  ];

  constructor() {}

  ngOnInit(): void {}
}
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda