Reputation: 333
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?
Upvotes: 1
Views: 313
Reputation: 543
Template.captureView.viewName.replace('Template.',''))
or
Template.instance().view.name.replace('Template.',''))
Upvotes: 1
Reputation: 47667
Try
let stringValueOfTemplateName = Template.instance().view.name.replace('Template.', '');
Upvotes: 1