有以下can.Model:
var CaseModel = can.Model.extend({
findAll: function(args){
var def = $.Deferred();
args.sobject.retrieve(args.criteria, function(err, records) {//records should be populated into view
if(err) def.reject(err);
else def.resolve(records);
});
return def;
}}, {});
我应该如何使用 init 方法实现 can.Control 以使用 defered=CaseModel.findAll({sobject: new SObjectModel.Case()}) 填充 can.view ,如下所示:
this.element.html(can.view('recipes', Defered));
以及这些记录如何在 mustache 模板中循环:{{#each ???? }}
谢谢