javascript - Meteor helper has run -
javascript - Meteor helper has run -
how can check meteor helpers have run?
when utilize code, new, empty div. when remove code rendered function , run console, works fine.
template.casesshow.helpers({ value: function (n) { if (this.data) { var result = this.data.filter(function (obj) { homecoming obj.name == n; }); if (result && result[0]) homecoming result[0].value; } } }); template.casesshow.rendered = function () { $(document).ready(function () { $textarea = $('[name=1]'); var content = $textarea.val().replace(/\n/g, '<br />'); $textarea.replacewith($('<div class="box">' + content + '</div>')); }); }; <template name="casesshow"> <textarea class="w-input box" placeholder="{{_ 'laborauftrag.praxis'}}" name="1" data-name="1">{{value 1}}</textarea> </template>
so think, meteor hasn't inserted value yet, unusual because shouldn't run rendered function then, right?
how can create sure meteor has run helpers?
template.rendered = func
run 1 time before template's helper (and long before route provides data). template isn't working when have template.rendered
function because in rendered function, replace textarea div, , in helper you're returning value beingness set on textarea no longer exist (because template.caseshow.rendered
has replaced <div>
.
if can provide more details you're trying accomplish here, can solve that. have right intended behaviour of meteor.
if want accomplish show content in div after replacing /n
<br>
, believe can performing regexp on data
in template helper.
javascript jquery meteor meteor-blaze
Comments
Post a Comment