[英]meteor blaze renderwithdata pass document to template with autoform
[英]Meteor Blaze.renderWithData(), how to pass functions
我有一個名為對話框的模板:
<template name="dialog">
<div id='overlay' class='overlay'>
{{title}}
{{description}}
</div>
</template>
我通過 blaze 函數按需渲染它:
Blaze.renderWithData(Template.dialog,{title:title,description:description,successfcnt:successfcnt,failfnct:failfnct},$("body")[0]);
到目前為止,這按預期工作。 但是因為它是一個模態對話框,所以我想將一個成功函數和一個失敗函數傳遞給模板。 我想在Template.events({...somewhere here...})
之一中使用這些函數。 如何訪問這些功能或更好地調用它們?
當使用Blaze.renderWithData()
訪問數據上下文時,可以通過簡單地使用this
來實現; 所以在你的情況下,我認為this.successfcnt();
應該做的伎倆。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.