Is (and if so - how?) it possbile to access store data from a component? I save some strings which I load in the application router like so:
//routes/application.js
import Ember from 'ember';
export default Ember.Route.extend({
model : function() {
var host = this.store.adapterFor('application').get('host');
var namespace = this.store.adapterFor('application').get('namespace');
var route = this;
return new Ember.RSVP.Promise(function (resolve) {
Ember.$.getJSON(host + '/' + namespace + '/strings/de').then(function (data) {
route.controllerFor('application').set('model', data);
//route.transitionTo('index');
resolve();
});
});
}
});
Since I’m pretty new to ember I don’t really know if this is the correct way anyways… So now is the question - how to access this store data in my component?
//components/t-string.js
import Ember from 'ember';
export default Ember.Component.extend({
tagName: '',
getString: function () {
var key = this.get('key');
// controller? store? how to get it?
var string = ''; // from store...
return string;
}.property()
});