iron-meteor/iron-controller

Template has no data in a RouteControllers event handler

Opened this issue · 0 comments

[Moved from https://github.com/iron-meteor/iron-router/issues/911]

For example

SomeController = RouteController.extend({
    template: 'myTemplate',
    data: function () { return SomeCollection.findOne(); },
    waitOn: function() { ... }
});

SomeController.events({
    'submit #my-form': function(evt, tpl){
        // this.data() works, tpl.data is undefined
        console.log(this.data(), tpl.data);
    }
});

Template.myTemplate.events({
    'submit #my-form': function(evt, tpl){
        // tpl.data is correct
        console.log(tpl.data);
    }
})

Maybe this is a bug, maybe intended?