Force a rudder template for rendering with a meteor

How can I get the meteor pattern (rudder pattern) to re-render through javascript. For instance,

I have a template (template1.html)

<template name="template1"> </template> 

I want to force this template from anywhere in my /client directory. Is there anything in the pen pack that can do this?

EDIT: Add More Information

I have no difficulty creating this template for the first time, whether using rudders or javascript. I want to update the template and call the rendered to restart. I have code that will retrieve and display related data when rendering this template.

 <template name="template1"> {{each items}} {{> template2}} {{/each}} <template/> 

if any data in the elements changes, then I understand that template1 and template2 will be displayed, but what happens when there is any data that changes in template2 , would I like to update / display template1 again?

+6
source share
2 answers

What changes in template2 that you see in template 1? Below will be updated template1 after insertion or deletion.

 <template name="template1"> {{itemsCount}} items {{#each items}} {{> template2}} {{/each}} <template/> 

Or,

  <template name="template1"> Last updated: {{lastUpdate}} {{#each items}} {{> template2}} {{/each}} <template/> Template.template1.lastUpdate = function () { return Session.get('lastUpdate'); }; 

Then somewhere you update your data:

  Session.set('lastUpdate', new Date() ); 
+1
source

FOR NEW VERSIONS OF USE OF METEORS UI.render () and UI.insert ()




defunc - for meteor versions that do not use flame

Can you provide more context?

Inside the html file to render this template, simply use:

 <div id="somediv"> {{> template1}} </div> 

If you want to do this through javascript, one way:

 $('#somediv').html(Meteor.render(Template.template1)); 

Take a look at:

+7
source

Source: https://habr.com/ru/post/945379/


All Articles