javascript - How can I change the body of template in meteor with a html on another template? -


i'm trying generate many graph on template, first graph default , i'd when click on zone generate graph exist in template. how can ?

i try return template other grahp.

template.test.events({'click .zone' : function (e){   console.log("j'ai cliqué sur le template test ... on va essayer d'ouvrir une pop up");   e.preventdefault();   //$('#animalsmodal').modal('show');   return {template: template[creategraph]}; }}); 

you can use template.dynamic purpose.

//html

<template name="graphdisplayer"> {{> template.dynamic template=helpertogetdynamictemplate}} </template> 

//js

template.graphdisplayer.oncreated(function(){   this.templatenameofgraph = new reactivevar('yourdefaulttemplate'); });  template.graphdisplayer.events({   'click .zone':function(e,t) {     t.templatenameofgraph.set('yourothertemplate');   } });  template.graphdisplayer.helpers({   helpertogetdynamictemplate:function(){     return template.instance().templatenameofgraph.get();   } }); 

Comments

Popular posts from this blog

qt - QML MouseArea onWheel event not working properly when inside QML Scrollview -

java - is not an enclosing class / new Intent Cannot Resolve Constructor -

python - Error importing VideoFileClip from moviepy : AttributeError: 'PermissionError' object has no attribute 'message' -