Search code examples
meteoriron-routermeteor-blaze

Simple meteor template helper not rendering in blaze


I can't access my data from my template helper into my template. It's so strange because I have done it 100x. Here is a simple example. I am able to do it on other route/template combinations I have setup but for some reason not on this one.

My console is empty and that console.log('helper ran') never runs as far as I can tell

In my departmentBH1.html

<template name="departmentBH1">
  <h1>WTF</h1>
  <h1>{{hospital}}</h1>
</template>

In my departmentBH1.js

Template.departmentBH1.helpers = ({
  hospital: function() {
    console.log('helper ran');
    return 'test';
  }
});

In my router.js

Router.route('/bh/departmentBH1', {
  name: 'departmentBH1'
});

which renders without the proper text from the helper

enter image description here


Solution

  • Try This:

    Template.departmentBH1.helpers({
      hospital: function() {
        console.log('helper ran');
        return 'test';
      }
    });
    

    Changed from helpers = ({ to helpers({