Strange behavior using a JSON in meteor -


in meteor app, have json file containing list of languages : list of language codes in yaml or json?

template.myprofile.helpers({   isolang: function(){     return json.parse(assets.gettext("myfile.json"));   } });  <select> {{#each isolang}}   whaterver put here {{/each}} </select> 

the problem no matter return in helper, save file, app template change login template (im using iron outer), , don't understand how it's possible.

i tried langauages list js object, public folder or myprofile subfolder (in client folder), brings me same problem, , no matter try, never enter {{#each}} condition.

what doing bad in use of json / js object ?

thanks you, david

the list of language codes neither json array (missing square brackets) nor (mongo) cursor. spacebar's #each meant

to iterate on array or database cursor (cf meteor docs ):

so need transform json object json array. here's basic sketch:

var jsonobj= {"a":"1","b":"2","c":"3","d":"4"}; var array = [];  var k = 0 for(var in jsonobj) {     if(jsonobj.hasownproperty(i)) {          array[k++] = jsonobj[i];           console.log(">> " + jsonobj[i])     }  }  console.log(array); 

Popular posts from this blog