【发布时间】:2015-12-16 04:47:50
【问题描述】:
为什么要写这个:
/client/Items.js
Template.Items.onCreated(function() {
console.log('Methor.call');
Meteor.call('Items.findAll', function (err, resp) {
console.log('Methor.call callback');
// Here I will use resp expecting it contains the response
// returned by the method
// ...
return;
});
return;
});
/ItemsMethods.js
Meteor.methods({
'Items.findAll': function () {
return Items.find({});
}
});
回调被静默忽略,即它没有被执行并且我没有收到任何错误?
请注意,如果我将这个return Items.find({}); 替换为这个return Items.find({}).fetch();,那么一切都会按预期工作。
【问题讨论】:
标签: javascript meteor meteor-methods