0

This is part of my router

App.Router.map(function () {
  this.resource('report', {path: '/noticia/:report_id'}, function() {
    this.route('pictures');
  });
});

I have defined an App.ReportPicturesController but my route App.ReportPicturesRoute insists on loading a different controller.

If I do not specify a model hook, it load the App.ReportController, and if I load the model I need (that is called comment) in loads the App.CommentController.

I've tried to set controllerName to reportPictures but it didn't work.

What I have to do to make the route load ReportPicturesController? Why is not loaded the expected controller?

EDIT: If it makes any difference, I'm using ember 1.8.1, ember-data 1.0.0-beta.12, and this is what the route looks like,

App.ReportPicturesRoute = Ember.Route.extend({
  model: function(params) {
    var report = this.modelFor('report');
    return this.store.createRecord('comment', {
      inReplyToStatus: report
    });
  }
});

EDIT2: The full source code is at https://github.com/camolin3/tweetsaster

4

2 回答 2

1

It is working as expected when I try.. have a look:

http://emberjs.jsbin.com/rayoje/2/

于 2014-12-03T22:10:22.227 回答
0

您缺少与此类似的 ReportRoute 模型挂钩实现

App.ReportRoute = Ember.Route.extend({
    model: function(params) {
        return {id:params.report_id}; 
        //or with ember-data return this.store.find('report', params.report_id);
    }
});
于 2014-12-19T08:52:36.150 回答