Im trying to display mongodb data in a html page in a meteor application. Here, 'yyyy' is a dynamic property name in the mongodb document.
{{#with pullData}}
<span>Root Url : {{xxxx.yyyy.zzzz}} </span>
{{/with}}
My mongodb document looks like this:
{ _id : '......',
xxxx:{
yyyy:{
zzzz: 'sampleData'
}}}
'yyyy' is dynamic -> can be different names of people(for example, John or Jane)
I tried using a helper to construct the "xxxx.John.zzzz" with the appropriate dynamic value and call the helper inside the handlebar but it returns it("xxxx.John.zzzz") as a string.
{{#with pullData}}
<span>Root Url : {{helper}} </span>
{{/with}}
Pls help ! Thank you ..
Have your helper return this.xxxx['yyyy'].zzzz;
Basically you need to use bracket notation instead of dot notation to access that sub-object using a variable name.
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.