Template.instance

Client Template.instance() import { Template } from 'meteor/templating' Source The template instance corresponding to the current template helper, event handler, callback, or autorun. If there isn't one, null.

template.firstNode

Client template.firstNode Source The first top-level DOM node in this template instance.

template.findAll

Client template.findAll(selector) Source Find all elements matching selector in this template instance. Arguments selector String The CSS selector to match, scoped to the template contents.

template.find

Client template.find(selector) Source Find one element matching selector in this template instance. Arguments selector String The CSS selector to match, scoped to the template contents.

template.data

Client template.data Source The data context of this instance's latest invocation.

Template.currentData

Client Template.currentData() import { Template } from 'meteor/templating' Source Inside an onCreated, onRendered, or onDestroyed callback, returns the data context of the template. Inside an event handler, returns the data context of the template on which this event handler was defined. Inside a helper, returns the data context of the DOM node where the helper was used. Establishes a reactive dependency on the result.

Template.body

Client Template.body import { Template } from 'meteor/templating' Source The template object representing your <body> tag.

template.autorun

Client template.autorun(runFunc) Source A version of Tracker.autorun that is stopped when the template is destroyed. Arguments runFunc Function The function to run. It receives one argument: a Tracker.Computation object.

template.$

Client template.$(selector) Source Find all elements matching selector in this template instance, and return them as a JQuery object. Arguments selector String The CSS selector to match, scoped to the template contents.

Template instances

Template instances A template instance object represents an occurrence of a template in the document. It can be used to access the DOM and it can be assigned properties that persist as the template is reactively updated. Template instance objects are found as the value of this in the onCreated, onRendered, and onDestroyed template callbacks, and as an argument to event handlers. You can access the current template instance from helpers using Template.instance(). In addition to the properties a