meteor blaze rendered being called before DOM completion -


i have template shows qrcode user id :

        <template name="pairdevice">           {{#with currentuser}}           <div id="qrcode"></div>           <div class="key" id="qrcodevalue" style="display: none;">{{id}}</div>           {{/with}}         </template> 

i tried setting value rendered , helper, it's same problem $('#qrcode') , $('#qrcodevalue') return [] fields don't exist yet.

template.pairdevice.rendered = function(){   if (!location.origin) {      location.origin = location.protocol+"//"+location.host;   }  // $('#qrcode').qrcode({width  : 128, height :128 ,text : $('#qrcodevalue').html()}); };  template.pairdevice.helpers({   'id' : function(){     var appuser =meteor.user();     var value = location.origin  + ";" + appuser._id + ";" + appuser.emails[0].address;      $('#qrcode').qrcode({width  : 128, height :128 ,text : value});     return value;   } }); 

i know blaze renders once, how can render after dom completion?

thanks

move {{#with currentuser}} outside of template.

<template name="pairdevice">   <div id="qrcode"></div>   <div class="key" id="qrcodevalue" style="display: none;">{{id}}</div> </template>  <!-- call --> {{#with currentuser}}   {{> pairdevice}} {{/with}} 

when first refresh page, believe currentuser undefined short time while client authenticates resume token. when pairdevice first rendered, currentuser undefined 2 divs #qrcode , #qrcodevalue not there when rendered callback called. moving outside of template, pairdevice template not rendered @ until currentuser defined.


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -