The error points to the *ngFor of nonvegfoodlist
app.component.ts
import { Component } from '@angular/core';
export class Menu
{
id : number;
name :string;
}
const veg : Menu[] = [
{ id:1 , name:'Rice'},
{ id:2 , name:'Dosa'},
{ id:3 , name:'Biriyani'},
{id :4 , name:'Pongal'}
];
const nonveg :Menu[] =[
{id :5 , name:'Fish Curry'},
{id:6, name:'Fish Fry'},
{ id:7 , name:'Half CB'}
];
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'Restarunt';
vegfoodlist = veg ;
nonvegfoodlist = nonveg;
}
app.component.html
<html>
<body>
<h1>
{{title}}
</h1>
<h2>Veg Food list</h2>
<div>
<ul class="vegfoodlist">
<li *ngFor ="let content of vegfoodlist">
<span>{{content.name}}</span>
</li>
</ul>
</div>
<div>
<ul class=" nonvegfoodlist">
<li *ngFor ="Let conten in nonvegfoodlist">
<span>{{conten.name}}</span>
</li>
</ul>
</div>
</body>
</html>
This is the list of errors that am getting from console:
Can't bind to 'ngFor' since it isn't a known property of 'li'
Property binding ngFor not used by any directive on an embedded template. Make >sure that the property name is spelled correctly and all directives are listed in the "@NgModule.declarations".
These are my questions,
1) is it possible to use multiple ngFor