java - Meteor dynamic templates from http call and form -


i'm recovering json formated http call. function launched parameters provided form template , parameters pushed on variables submit event.

my function getusershttp able return results i'm able see console.log(results.content);:

"results" : [       {          "name" : {             "first" : "billy",             "last" : "mckornic"          },          "id" : "a1c3fd06c71ccc50998baa02074976b4d639e4cf",          "situation" : "free",       },       {          "name" : {             "first" : "dough",             "last" : "wallas"          },          "id" : "5694c02beaf20d2d4b5747668b82264af8547e33",          "situation" : "occuped",       }    ],    "status" : "ok" } 

i put each result in articles template with:

<template name="articles">     {{#each results}}         <header>             <p>{{name.first}} {{name.last}}</p>             <p>{{id}}</p>             <p>{{situation}}</p>         </header>     {{/each}} </template> 

what template event , function must create in order provide each results data? have:

template.articles.helpers({     results : function() {       return meteor.call("getusershttp",formparamx,formparamy);        }   }); 

but have java error on page loading since form not submited , formparamx , formparamy not populated. how force template (event & function) wait form submited in order start providing results?

thanks!

set values formparamx , y reactive variables, can do:

results() {     if( template.instance().formparamx.get() && template.instance().formparamy.get() ) {         return meteor.call("getusershttp",formparamx,formparamy);        } } 

then time form parameters change, you'll recall meteor method , appropriate data.

additional documentation on reactive variables here, , there nice walkthrough on themeteorchef.


Comments

Popular posts from this blog

routing - AngularJS State management ->load multiple states in one page -

python - GRASS parser() error -

Swift game error message -