How To Avoid Meteor Helpers Run Multiple Times
In my template I have this HTML:
Solution 1:
The card
helper is executed several times since card
is present in evaluated template code more than once.
A pattern to avoid duplicate calls in scenarios like the one you're facing is to use #with
:
{{#with card}}
<inputid="name"type="text" value="{{name}}">
<inputid="prefix"type="text" value="{{prefix}}">
<inputid="phone"type="tel" value="{{phone}}">
{{/with}}
This will call card
once and then run the nested code in the context of its result.
Post a Comment for "How To Avoid Meteor Helpers Run Multiple Times"