我在流星项目中有错误 - 就像那样:
TypeError: callbacks[i].call is not a function
at template.js:116
at Function.Template._withTemplateInstanceFunc (template.js:437)
at fireCallbacks (template.js:112)
at [object Object].<anonymous> (template.js:205)
at view.js:104
at Object.Blaze._withCurrentView (view.js:523)
at view.js:103
at Object.Tracker._runFlush (tracker.js:468)
at onGlobalMessage (setimmediate.js:102)
你对此有什么想法吗?
增加: 1)at template.js:116
var fireCallbacks = function (callbacks, template) {
Template._withTemplateInstanceFunc(
function () { return template; },
function () {
for (var i = 0, N = callbacks.length; i < N; i++) {
callbacks[i].call(template);
}
});
};
答案 0 :(得分:4)
我发现了问题! 那是因为:
Template.user_lesson.onRendered({});
应该是这样的:
Template.user_lesson.onRendered(function(){});
我没有在父模板中使用它并出错。 谢谢!