AmpersandJS/ampersand-view — pull request #23 by nathanstitt (2014-07-12 18:51:59+00:00)
Title: Call "template" method with scope set

After the second time getting bit by this, figured it was time to fix it. I left the context variable being passed as an argument since to avoid it being a breaking change.

Currently template is called without a scope, so "this" refers to window, rather than the object the method was defined in.

This avoids writing non-intuitive code such as:

AmpersandView.extend({
values: [1,2,3],
template: function(constext){
return context.values.join(", ")
}
})

In favor of:

AmpersandView.extend({
values: [1,2,3],
template: function(){
return this.values.join(", ")
}
})