我最近开始学习CoffeeScript,我遇到了这样的问题。我想写javascript:
TemplateManager.tmpl(this.template, this.modelJSON(), this.templateOptions()).done(
function(rendered) { // something1
}).fail(function(ex) {
// something2
});
我可以通过什么方式得到它?我尝试重写:
TemplateManager.tmpl @template, @modelJSON(), @templateOptions()
.done (rendered) ->
#something1
.fail (ex) ->
#something2
我得到:
TemplateManager.tmpl(this.template, this.modelJSON(), this.templateOptions().done(function(rendered) {
}).fail(function(ex) {
}));