出现以下错误: 编译失败。
./ src / app / menu / menu.component.ts 找不到模块:错误:无法解析“ / Users / parthiljagani / Desktop / git-test2 / Angular / conFusion / src / app / menu”中的“ ../ shared / dishes”
,我在下面附上了我的代码。请帮助我找到错误。 谢谢。
这是我的盘。代码:
import { Dish } from "./dish";
export const DISHES: Dish[]= [
{
id: '0',
name: 'Uthappizza',
image: '/assets/images/uthappizza.png',
category: 'mains',
featured: true,
label: 'Hot',
price: '4.99',
// tslint:disable-next-line:max-line-length
description: 'A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.',
comments: [
{
rating: 5,
comment: 'Imagine all the eatables, living in conFusion!',
author: 'John Lemon',
date: '2012-10-16T17:57:28.556094Z'
},
{
rating: 4,
comment: 'Sends anyone to heaven, I wish I could get my mother-in-law to eat it!',
author: 'Paul McVites',
date: '2014-09-05T17:57:28.556094Z'
},
{
rating: 3,
comment: 'Eat it, just eat it!',
author: 'Michael Jaikishan',
date: '2015-02-13T17:57:28.556094Z'
},
{
rating: 4,
comment: 'Ultimate, Reaching for the stars!',
author: 'Ringo Starry',
date: '2013-12-02T17:57:28.556094Z'
},
{
rating: 2,
comment: 'It\'s your birthday, we\'re gonna party!',
author: '25 Cent',
date: '2011-12-02T17:57:28.556094Z'
}
]
},
{
id: '1',
name: 'Zucchipakoda',
image: '/assets/images/zucchipakoda.png',
category: 'appetizer',
featured: false,
label: '',
price: '1.99',
description: 'Deep fried Zucchini coated with mildly spiced Chickpea flour batter accompanied with a sweet-tangy tamarind sauce',
comments: [
{
rating: 5,
comment: 'Imagine all the eatables, living in conFusion!',
author: 'John Lemon',
date: '2012-10-16T17:57:28.556094Z'
},
{
rating: 4,
comment: 'Sends anyone to heaven, I wish I could get my mother-in-law to eat it!',
author: 'Paul McVites',
date: '2014-09-05T17:57:28.556094Z'
},
{
rating: 3,
comment: 'Eat it, just eat it!',
author: 'Michael Jaikishan',
date: '2015-02-13T17:57:28.556094Z'
},
{
rating: 4,
comment: 'Ultimate, Reaching for the stars!',
author: 'Ringo Starry',
date: '2013-12-02T17:57:28.556094Z'
},
{
rating: 2,
comment: 'It\'s your birthday, we\'re gonna party!',
author: '25 Cent',
date: '2011-12-02T17:57:28.556094Z'
}
]
},
{
id: '2',
name: 'Vadonut',
image: '/assets/images/vadonut.png',
category: 'appetizer',
featured: false,
label: 'New',
price: '1.99',
description: 'A quintessential ConFusion experience, is it a vada or is it a donut?',
comments: [
{
rating: 5,
comment: 'Imagine all the eatables, living in conFusion!',
author: 'John Lemon',
date: '2012-10-16T17:57:28.556094Z'
},
{
rating: 4,
comment: 'Sends anyone to heaven, I wish I could get my mother-in-law to eat it!',
author: 'Paul McVites',
date: '2014-09-05T17:57:28.556094Z'
},
{
rating: 3,
comment: 'Eat it, just eat it!',
author: 'Michael Jaikishan',
date: '2015-02-13T17:57:28.556094Z'
},
{
rating: 4,
comment: 'Ultimate, Reaching for the stars!',
author: 'Ringo Starry',
date: '2013-12-02T17:57:28.556094Z'
},
{
rating: 2,
comment: 'It\'s your birthday, we\'re gonna party!',
author: '25 Cent',
date: '2011-12-02T17:57:28.556094Z'
}
]
},
{
id: '3',
name: 'ElaiCheese Cake',
image: '/assets/images/elaicheesecake.png',
category: 'dessert',
featured: false,
label: '',
price: '2.99',
description: 'A delectable, semi-sweet New York Style Cheese Cake, with Graham cracker crust and spiced with Indian cardamoms',
comments: [
{
rating: 5,
comment: 'Imagine all the eatables, living in conFusion!',
author: 'John Lemon',
date: '2012-10-16T17:57:28.556094Z'
},
{
rating: 4,
comment: 'Sends anyone to heaven, I wish I could get my mother-in-law to eat it!',
author: 'Paul McVites',
date: '2014-09-05T17:57:28.556094Z'
},
{
rating: 3,
comment: 'Eat it, just eat it!',
author: 'Michael Jaikishan',
date: '2015-02-13T17:57:28.556094Z'
},
{
rating: 4,
comment: 'Ultimate, Reaching for the stars!',
author: 'Ringo Starry',
date: '2013-12-02T17:57:28.556094Z'
},
{
rating: 2,
comment: 'It\'s your birthday, we\'re gonna party!',
author: '25 Cent',
date: '2011-12-02T17:57:28.556094Z'
}
]
}
];
This is my menu.component.ts code:
import { Component, OnInit } from '@angular/core';
import { Dish } from '../shared/dish';
import { DISHES } from "../shared/dishes";
@Component({
selector: 'app-menu',
templateUrl: './menu.component.html',
styleUrls: ['./menu.component.css']
})
export class MenuComponent implements OnInit {
dishes: Dish[] = DISHES;
selectedDish: Dish = DISHES[0];
constructor() { }
ngOnInit(): void {
}
}
This is my dish.ts code:
import { Comment } from "./comment";
export class Dish{
id: string;
name: string;
image: string;
category: string;
featured: boolean;
label: string;
price: string;
description: string;
comments: Comment[];
}
This is my comment.ts code:
export class Comment {
rating: number;
comment: string;
author: string;
date: string;
}