I have a rails view that needs to supply data to a controller before the app is running. It seems the inject/intializer calls would be appropriate for this. Unfortunately, the current methods seem really cumbersome for what I want to do (or the docs are hard to grok). The best example I’ve found so far might be this post about introducing a currentUser variable to every controller:
https://gist.github.com/ivanvanderbyl/4560416
What I want is simpler. And, I think should be super easy for everyone to do as a new user. Say you a controller and you want to introduce the variable “awesomeData” to it in a script tag on the page hosting/rending your ember app (this is a common paradigm if you are using Ember apps as “partials” on otherwise normal HTML/js pages. You might imagine something like:
MyApplication.injection('controller:first, 'awesomeData');
Mind you, I don’t really understand the current syntax or what ‘controller:firstController’ or 'data:awesome" would or should even do (injectionName? factoryName?!?), but I do know I’d like the call to be as simple as this. Then, when my firstController is active, I’d have:
MyApplication.FirstController = Ember.Controller.extend({
someProperty: function() {
return this.get('awesomeData');
}
});
Is it already this simple? Can it be so?! Thanks!