[英]Access child template helpers/variables from parent in Meteor
Making a user picker controller and am having trouble getting the users out from parent. 制作用户选择器控制器并且无法将用户从父级中取出。
Parent template has 父模板有
{{> userPicker}}
Child updates reactive vars, stored as this.someVar = new ReactiveVar(...)
. 子更新反应变量,存储为
this.someVar = new ReactiveVar(...)
。
How do I get a ref to this
of userPicker
from parent template? 我如何获得一个裁判
this
的userPicker
从父模板?
I ended up passing a dictionary by reference from the parent and had the child put stuff into it. 我最后通过父母的参考传递了一本字典,让孩子把东西放进去。
In parent html 在父html中
{{> userPicker userContext }}
In parent js 在父母js
const users = {};
And as helper 作为帮手
userContext() {
return users;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.