Search code examples
javascriptmeteormeteor-blaze

Meteor.js : How to get the name of a Template from the Template?


Lets say I have a definition of a template in a html file.

<template name="myTemplate">

Now in javascript I want to get the value that is name in template by referencing the Template itself to avoid typing mistakes and to allow intellij ide ctrl clicking of the template to take me to the template.

I want something like.

let stringValueOfTemplateName = Template.myTemplate.name

Instead of having to do

let stringValueOfTemplateName = "myTemplate"

Is there any way to access the name?


Solution

  • Template.captureView.viewName.replace('Template.',''))
    

    or

    Template.instance().view.name.replace('Template.',''))