Closed comerc closed 8 years ago
I'm actually a little unsure myself about how the call to templateInstance()
is reactive – when, exactly, is it invalidated? Anyway, I'm simply passing this reactivity on to the user of ViewModel.
We may use Template.currentData():
Establishes a reactive dependency on the result.
Or not?
UPD:
Uncaught Error: There is no current view
OK, we may use Template.currentData() in this cases with fields of Template.instance().viewmodel.
- 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.
In API help:
In source-code:
According to Meteor's documentation, about template.data: