jeudi 17 septembre 2015

ember cli environment configuration

Could someone please provide an example for this. I am not getting this to work.

http://ift.tt/1UWuwEx

I have set an environment variable in my config/environment.js file. In a route action I want to access this variable. But ENV is undefined.

environment.js

if (environment === 'test') {
   ENV.APP.REPORTING_SERVICE_URL = 'http://ift.tt/xKZb52';
}
if (environment === 'production') {
   ENV.APP.REPORTING_SERVICE_URL = 'http://ift.tt/fyw30c';
}

Route

import ENV from 'my-demo-app/config/environment';

export default Ember.Route.extend({
   actions: {
     doSomething: function() {
       console.log(ENV.REPORTING_SERVICE_URL); // ENV is undefined
     }
   }
});




Aucun commentaire:

Enregistrer un commentaire