Reputation: 1460
I have two routes, let's call them /user and /user/actions. How do I access the user model from a UserActionsController method?
I've tried something like:
this.modelFor('user').get('id')
and
this.get('target').modelFor('user').get('id)
but in both cases it sais that 'modelFor' is undefined and not a function.
Upvotes: 1
Views: 162
Reputation: 47367
in a controller you would use needs
and then get it off the controller.
App.FooController = Ember.ObjectController.extend({
needs:['userActions'],
blah: function(){
var userActionsModel = this.get('controllers.userActions.model');
}
});
http://emberjs.jsbin.com/dofedehi/1/edit
Upvotes: 3
Reputation: 1258
Maybe I have not given this enough thought, but can't you simply access
App.User
?
I might have misunderstood the question of course.
Upvotes: 0