I have a mithril component with an controller which is already bounded to an context, if I use m.component(), mithril disregards the bounded controller and supplies the view with an default empty controller
UserWidget = function(){
this.allUsers = User.load();
this['header'] = {
'controller' : function(users){
this.users = users;
}.bind(this, this.allUsers),
'view' : function(ctrl) {
console.log('ctrl', ctrl)
if (ctrl.users()) {
return m('.user', ctrl.users()[0].name());
}
}
}
}
//initialize
m.module(document.body, m(new UserWidget().header));
However if I pass view/controller via m.module everything works as expected
m.module(document.body, new UserWidget().header);
https://jsfiddle.net/chifer/mwddffy4/2/
Is it a caveat that component controllers should be unbounded and passed params via the m.component call? or is this a bug?