Is there a way to directly assign an object to a template and let it show his properties ?
A thing like this
//Object returned is {totalResults:34,firstName="hoyo"}
Template.myTemplate = function(){
return Session.get("anObject");
};
on this template :
<template name="myTemplate">
<h3>Info results : {{totalResults}}</h3>
<span>Other things : {{firstName}}</span>
</template>
With thanks
You can use dot notation. But you still need to make a Template helper within the template. Template.mytemplate is reserved for the actual template instance.
Your JS
Template.myTemplate.data = function(){
return Session.get("anObject");
};
Your HTML
<template name="myTemplate">
<h3>Info results : {{data.totalResults}}</h3>
<span>Other things : {{data.firstName}}</span>
</template>