Why can't I get a reference to my model within my controller


#1

Shouldn’t I be able to get my controllers model by doing this.get(“content”) or this.get(“model”)?


#2

For help like this, try Stack Overflow first. Perhaps someone else already answered it, but if not, raise the question and someone will probably pop in. If not, let me know and I’ll take a look for sure. This forum is for more general/community discussion.


#3

It would help if you would provide code (or if you’ve asked this on StackOverflow, a link to the SO question), but the most likely reasons are:

  • your controller is not an ObjectController (if you defined it yourself, make sure you did Ember.ObjectController.extend instead of Ember.Controller.extend)
  • In your route you overrode the setupController method and did not call this._super(). The default behavior of the setupController hook is to set the model property on your controller, so if you wrote your own setupController and didn’t call super, you may have inadvertently removed that functionality