HTML:
<div *ngFor="let nav of navList">
{{ nav }}
</div>
TS:
@Input() navList: string[] = ['test1', 'test2', 'test3'];
Ok, so these are my files, the parts where i create the variable and initialize it in the TS with the mock values, and when i call it in the HTML using the ngFor property. Nothing is displayed in the web page and this is the error it returns:
NG0303: Can't bind to 'ngForOf' since it isn't a known property of 'div'.
And yes, I have the Common Module and the Browser module and the browser animation module all imported in the app.module and in the component's module. Does anyone know what else should i do to fix this?
CodePudding user response:
I don't know what problem you are having but I tried to make simple ngFor in this project and work fine.
https://stackblitz.com/edit/angular-ivy-beeizd?file=src/app/app.component.html
CodePudding user response:
It may happen, if you are not declaring in declarations of app.module.ts.