I'm developing an addon for Ember CLI which requires me to dynamically load files from the app. I should be able to do this with a command like require('my-app/models/load-me')
. The only problem is that my-app
could be anything, depending on what the developer named their application. If I had access to the my-app/config/environment
file, I could just get the modulePrefix
from there, but unfortunately, that's also namespaced under my-app
.
So does anyone know of another way to access the modulePrefix
? I'm assuming there must be a way, because Ember CLI itself needs to get that prefix before it can load any files.
Found the answer here. Basically, you can look it up through the container like so:
this.container.lookupFactory('config:environment').modulePrefix;