3 ms·
http://docs.meteor.com/#template_instance http://docs.meteor.com/#template_instance http://docs.meteor.com/#tracker_autorun http://docs.meteor.com/#tracker_auto
by maxharris 12y ago
http://docs.meteor.com/#template_instance http://docs.meteor.com/#template_instance
http://docs.meteor.com/#tracker_autorun http://docs.meteor.com/#tracker_autorun
Suppose you want to make a widget, such as a drop-down menu that lets you edit the currently selected item. To do that, you need a place to store the currently selected item id. Storing this in a collection is not desirable either. If you rely on session variables, you can't have more than a single instance of your widget running at a time because session variables are globally scoped.
Now with template instances, there's finally a way to store and retrieve that selected item id (or anything else, for that matter) in a way that's conveniently accessible within template helpers and event handlers on a per-template basis.