lundi 21 décembre 2015

EmberJS, How to import files using root path?

I have this a model in this path:

/my-project/app/models/my-model.js

And I want to import it from a route in this path:

/my-project/app/routes/battles/battle/combats/new.js

The import sentence looks like this:

import MyModel from '../../../../models/my-model';

The path is insane, I have to use the try and error system to figure out it. Also if I want to import the same model in another component I can't just copy&paste because this path is only valid from an specific path. For the same reason if I change the path of the component importing my model I have to update the import path.

I would like to have path relative to the root of the project, something like:

import MyModel from '/models/my-model';

Is this possible?




Aucun commentaire:

Enregistrer un commentaire