テンプレートでイベントが発生すると、別のテンプレートで何かを実行したい。
これは私のコードです:
クライアントhtml:
<body> Navigation: {{> navigation}} ======================================================= Body: {{> body}} </body> <template name="navigation"> <input type="button" value="MenuBtn" /> </template> <template name="body"> {{content}} </template>
JavaScript:
Template.navigation.events({
「クリック」: 関数 (e) {
// {{body}} で何も起こらなかった
Template.body.content = function(){
// 何かしたい... データベースのクエリなど
// おそらく、単なる例です: return peple.find({"name":e.currenTarget.value});
「こんにちは」を返します。
};
} });
私が間違っていることについて何か考えはありますか?