Meteor - Read HTML file contents and store in a variable

152 Views Asked by At

I am a newbie to Meteor. In my earlier project (Front end: Plain JS), i used 'underscore' js library as templating engine. I would like to acheive the same in meteor. But i face problems in getting HTML file contents. Let's go with the scenario in older project,

In a JS file (myfilename.js.php)

var htmlstr = <?php echo jsonStringify('../templates/template-name.html'); ?>;
var myData = [{id: 1}, {id:2}];
$(selector).html(_.template(htmlstr, {data: myData }));

This will generate HTML string and append to the specific selector(either DIV/HTML... )

The Meteor also supports underscore JS. I would like to apply same thing and same methodology here. I am struggling to achieve the first step(including html file content in a variable)

Could someone please help me in solving this.

Thank you.

0

There are 0 best solutions below