I use EmberJS 2.4.2. I want to use environment.js file to handle custom configuration entries. Eg
var ENV = {
APP: {
myKey: "defaultValue"
}
};
It works fine in development mode, but after I perform 'ember build -prod', the variable is inaccessible - in the production mode the variable is 'undefined'.
I use the key in following manner:
import ENV from '../config/environment';
(...)
ENV.APP.myKey
What am I doing wrong and how to resolve the problem correctly?
The problem is solved. The variable was undefined only if I merged my client-side app (written with Ember) into index.html of my server-side and I did not copy the meta tag with new config/environment definition.
After doing so, the configuration key was easily accessible.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.