samedi 30 janvier 2021

Ember load data from local file

Hi I am trying to load data (products) from local file. Here is how I try to fetch data:

import { products } from '../data/products'; 

export default class ItemRoute extends Route {
    model(params){
        const item_id = params;
        console.log(item_id);
        const product = products.find(({ id }) => id === item_id);
        
        return item_id;
    }
}

but I get this error Uncaught Error: Could not find module ember-app/data/products imported from ember-app/routes/item.

Can someone, please, give advice how to resolve that? Thanks a lot.




Aucun commentaire:

Enregistrer un commentaire