How to Access Collectin Object data in HTML Using meteor? -


i need know access collection object data in html shown below :

var fielddata = [        {fieldname: "hcare1",         fieldoptions: [ "bike","car","tv","radio","etc"]        },        {fieldname: "hcare2",         fieldoptions: [ "bike1","car1","tv1","radio1","etc"]        },       {fieldname: "hcare3",         fieldoptions: [ "bike2","car2","tv2","radio2","etc"]       }      ]; 

in above code how access fieldoptions data in html.the fielddata inserted collection i.e collection name fields.i'm new meteor.so can please suggest me do?

in mongo console:

db.foo.findone().fieldoptions; [ "bike", "car", "tv", "radio", "etc" ] 

or on client:

collectionname.findone().fieldoptions; 

in js:

 template.your_layout.helpers({    fieldoptions: function() {     fields.findone().fieldoptions;    }  }); 

in html:

{{#each fieldoptions}}   {{this}} {{/each}} 

smth this...


Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -