Reentering a route doesn't load content

心已入冬 提交于 2020-02-24 11:37:31

问题


I've got a route set up like this:

App.UserRoute = Ember.Route.extend({
    renderTemplate: function() {
        this.render('settings/user', {into: 'application', controller: 'User'});
        this.render('settings/user_left', {outlet: 'left_menu'});
    },
    setupController: function(controller, user){
        this.controllerFor('users').set('content', App.User.find());
    }
}

Controller is:

App.UsersController = Ember.ArrayController.extend();
App.UserController = Ember.ObjectController.extend({
    needs: 'users',
    contentBinding: 'controllers.users.firstObject',
});

If I navigate to /user it's ok. If I then navigate to somewhere else and press BACK (or just open the route), content of the template is never filled out, even though App.User.find() returns data properly and controllerFor also finds a controller. I think I'm doing something wrong with controllers but can't find what... If the page is refreshed it works fine of course.

Thanks

来源:https://stackoverflow.com/questions/15682550/reentering-a-route-doesnt-load-content

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!