我正在使用InMemoryDataService来模拟Web服务器,并且我能够成功返回一个json对象。
我试图使用相同的方法返回多个json对象,但不确定如何。 下面是代码,并希望再添加一个对象作为'inMemCall'
由于
export class InMemoryDataService {
createDb() {
let inMemCall = [
{
category: 'Appetizers',
details: [{
title: 'Item x1',
price:'40.00',
description:'testing World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! '
},
{
title: 'Item x2',
price:'42.00',
description:'Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! '
},
{
title: 'Item x3',
price:'44.00',
description:'Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! '
}]
},
{
category: 'Soups and Salads',
details: [{
title: 'Item x4',
price:'40.00',
description:'Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! '
},
{
title: 'Item x5',
price:'42.00',
description:'Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! '
},
{
title: 'Item x6',
price:'44.00',
description:'Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! '
}]
},
{
category: 'Entre',
details: [{
title: 'Item x7',
price:'40.00',
description:'Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! '
},
{
title: 'Item x8',
price:'42.00',
description:'Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! '
}]
},
{
category: 'Sides',
details: [{
title: 'Item x9',
price:'40.00',
description:'Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! '
}]
},
{
category: 'Deserts',
details: [{
title: 'Item x10',
price:'40.00',
description:'Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! '
},
{
title: 'Item x11',
price:'42.00',
description:'Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! '
}]
},
{
category: 'Drinks',
details: [{
title: 'Item x12',
price:'40.00',
description:'Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! '
},
{
title: 'Item x13',
price:'42.00',
description:'Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! '
},{
title: 'Item x14',
price:'40.00',
description:'Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! '
},
{
title: 'Item x15',
price:'42.00',
description:'Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! '
}]
}
];
return {inMemCall};
}
}