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
Post a Comment