export class Dish {
}
File2
import { Dish } from '../shared/dish';
const DISHES: Dish[] = [
{
id: '0',
name: 'Uthappizza',
image: '/assets/images/uthappizza.png',
category: 'mains',
featured: true,
label: 'Hot',
price: '4.99',
}
]
export class MenuComponent implements OnInit {
dishes: Dish[] = DISHES;
}
Can you explain why the properties are accessed using dish.name and dish.image instead of Dish.name, given that the array is named Dish[] and the class is named Dish?
Html file
<img height="200px" src={{dish.image}} alt={{dish.name}}>