我遇到了aldeed:autoform的问题,我无法解决,也不知道是什么原因。模板:
<template name="staffCaseEdit">
{{> quickForm collection=Cases id="inserNewItem" type="insert"}}
</template>
我使用aldeed:collection2和aldeed:simple-schema来管理集合。因此,我有
Case
架构和Cases
集合,它们都在/lib
中定义,因此它们也应该在客户端可用。接下来是路线:
FlowRouter.route('/staff/case/:id', {
triggersEnter: [
AccountsTemplates.ensureSignedIn
],
subscriptions: function (params) {
this.register('theCase', Meteor.subscribe('theCase', params.id));
},
action: function (params, queryParams) {
return BlazeLayout.render('container', {
main: 'staffCaseEdit',
id: params.id
});
}
});
当然,
theCase
已发布:Meteor.publish('theCase', function (id) {
return Cases.find({
id: Number(id)
});
});
在浏览器控制台中,存在案例:
> Cases
< Object
> Cases.find().count()
< 1
我建议足以使quickForm正确使用集合(它需要一个作为参数之一)。
问题是,在客户端,我遇到了一个错误
Exception in template helper: quickFormContext@http://localhost:3000/packages/aldeed_autoform.js?b0918af3b0bb0ae387d80c71f4230daca94cae11:6851:34
我无法追踪。结果,没有显示任何形式(实际上,整个DOM留为空白。
我应该找什么?这个特定问题的根源可能是什么?
最佳答案
这里有点黑暗,我不知道它是否可以解决您的问题,但肯定会有所帮助...使用此功能:
<template name="staffCaseEdit">
{{> quickForm collection="Cases" id="inserNewItem" type="insert"}}
</template>
您要将变量
Cases
传递给collection参数,而不是将其传递给目标collection "Cases"
的名称。关于javascript - 在模板助手中获取异常:带有aldeed:autoform的quickFormContext,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/32496931/