I'm not sure if this is the right way. But generally EAK tries to avoid polluting the global namespace. So a method to have globals accessible every where is to use initializers to register a globals dependency and inject them to all the controllers. This is the same way ember data injects the store to the controller.
Inside app/initializers
create global.js
file
var globals = Ember.Object.extend({
name: 'Edgar Allen Poe'
});
export default {
name: "Globals",
initialize: function(container, application) {
container.typeInjection('component', 'store', 'store:main');
application.register('global:variables', globals, {singleton: true});
application.inject('controller', 'globals', 'global:variables');
}
};
This will inject the globals to all the controllers.
You can refer it in a template like
{{globals.name}}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…