Dima Feldman
Dima Feldman

Reputation: 708

Ember.js data from model doesn't being passed to the view when using ObjectController

I have this route:

App.BoardEditItemRoute = Ember.Route.extend({
    model: function(params) {
        return this.store.find('boardItem', params.board_item_id);
    },
    renderTemplate: function() {
        this.render('board-edit-item', {into: 'application'});
    }
});

and this controller:

App.BoardEditItemController = Ember.ObjectController.extend({
    pageTitle: 'Edit board item'
});

the boardItem model:

App.BoardItem = DS.Model.extend({
    title: DS.attr('string'),
    income: DS.attr('number'),
    outcome: DS.attr('number'),
    date: DS.attr('date'),
    itemType: DS.attr('string'),
    board: DS.belongsTo('Board'),
    boardId: DS.attr('string')
});

and this in the view:

{{input value=title}}

the title should come from the store, but it doesn't show... unless I completely remove Ember.ObjectController.

any ideas why?

Thanks!

Upvotes: 1

Views: 45

Answers (2)

Dima Feldman
Dima Feldman

Reputation: 708

Apparently the reason for the weird behaviour was having

renderTemplate: function() {
    this.render('board-edit-item', {into: 'application'});
}

present in the route.

does anyone know why it breaks it?

Upvotes: 1

Kingpin2k
Kingpin2k

Reputation: 47367

title shouldn't be in quotes (assuming title is defined on your boardItem model).

 {{input value=title}}

Upvotes: 1

Related Questions