I have a collection of JSON objects stored in the InMemoryDataService (mock server) and services.ts file. These objects contain various elements that I want to display on an HTML page by replacing productId and shopId with product.name and shop.name respectively, based on their unique IDs. How can I achieve this?
createDb() {
const prices = [
{ id: 11, price: 3.40, dateFrom:'12/3/19', dateTo: '15/3/19', productId: 3,shopId: 4},
{ id: 12, price: 5.40, dateFrom:'6/3/19', dateTo:'22/3/19', productId: 1,shopId: 4},
{ id: 13, price: 8.00, dateFrom:'21/3/19', dateTo:'23/4/19', productId: 2,shopId: 2},
{ id: 14, price: 6.30, dateFrom:'17/3/19', dateTo:'23/3/19', productId: 3,shopId: 3},
];
const products = [
{id:1, name: 'Barilia', description: 'Good Coffee', category :'Espresso', tags:['Coffe','Espresso'], withdrawn: false},
{id:2, name: 'Nespresso', description: 'Good Coffee', category :'Espresso', tags:['Coffe','Espresso'], withdrawn: false},
{id:3, name: 'Island', description: 'Good Coffee', category :'Cappuchino', tags:['Coffe','Cappuchino'], withdrawn: false},
{id:4, name: 'Lavanca', description: 'Good Coffee', category :'Espresso', tags:['Coffe','Espresso'], withdrawn: false}
];
const shops = [
{ id: 1, name: 'Coffee Island',address: 'Agioi Theodwroi 10,Petroupoli,14432', Ing: 30.5 , Iat: 54.44,tags ['Coffee','Espresso'],withdrawn:false},
{ id: 2, name: 'Coffee Bear',address: 'Valsamou 42,Kifisia,14675', Ing: 32.5 , Iat: 60.43,tags:['Coffee','Espresso'], withdrawn:false },
{ id: 3, name: 'Coffee Lab',address: 'Thiseas 10,Marousi,31313', Ing: 29.5 , Iat: 50.44, tags:['Coffee','Espresso'], withdrawn:false },
{ id: 4, name: 'Starbucks',address: 'Kifisias 7,Kifisia,12345', Ing: 27.8 , Iat: 37.9,tags:['Coffee','Espresso'], withdrawn:false }
];
return {products,prices,shops};