Reputation: 3471
After using _.bindAll('addOne')
, the addOne
method does get a correct this
but it somehow breaks function calls on other objects inside this "bound" method :
/**
* Add an element to the list
*/
addOne: function(tag) {
// scope of this is correct
var newClass = App.getViewClass('myClass')(someOptions) <-- scope inside App::getViewClass is wrong! overriden by current this
}
Any ideas on how i could somehow restore normal behavior?
Upvotes: 1
Views: 237
Reputation: 3471
Needed to wrap my getter :
var myObject = new (App.getModelClass(model))(data);
As i got incorrect scope with :
var myObject = new App.getModelClass(model)(data);
Upvotes: 1