简体   繁体   中英

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(...) .

How do I get a ref to this of userPicker from parent template?

I ended up passing a dictionary by reference from the parent and had the child put stuff into it.

In parent html

{{> userPicker userContext }}

In parent js

const users = {};

And as helper

userContext() {
  return users;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM