Reputation: 127
I'm trying to use the HTML tag to build a table and got the error in the title.
Here is the template:
<template ngfor let-log [ngForOf]="logs">
<tr>
<td [lgStatus]="log.level" class="ion-record"></td>
<td>{{log.timestamp | date:'medium'}}</td>
<td>{{log.source}}</td>
<td>{{log.message}}</td>
</tr>
<tr>
<td colSpan="4">{{log.detailedMessage}}</td>
</tr>
</template>
I checked several threads and I correctly imported the BrowserModule in the app.module.ts and the CommonModule in the component related to this template.
I don't see what I have done wrong here :(
Thanks in advance for your help. Serge.
Upvotes: 0
Views: 2007
Reputation: 86800
Exact syntax will be ngFor
not ngfor
so use your code like this-
<template ngFor let-log [ngForOf]="logs">
for more type you can refer here
Upvotes: 1
Reputation: 222722
There is a small typo,
<template ngFor let-log [ngForOf]="logs">
Upvotes: 0
Reputation: 658057
<template ngfor let-log [ngForOf]="logs">
has to be
<template ngFor let-log [ngForOf]="logs">
^
You can use <ng-container>
instead of <template>
to be able to use the more common syntax
<ng-container *ngFor="let log of logs">
Upvotes: 0