Reputation: 1858
How we can access this.store in Ember.view ? I tried inject method , but it doesn't work for me . Is there any way to do this ?
Upvotes: 0
Views: 282
Reputation: 1780
This is an antipattern you want to send an action to the controller and do you work with the store in the controller.
However if you have to inject the store into the view you would do this.
Ember.onLoad('Ember.Application', function(Application) {
Application.initializer({
name: "store",
initialize: function(container, application) {
application.register('store:main', application.Store);
...
}
container.lookup('store:main');
}
});
Application.initializer({
name: "injectingTheStore",
initialize: function(container, application) {
application.inject('view', 'store', 'store:main');
}
});
Upvotes: 2