{{> photographyServicesFor...">

How to get a data object from a specific template instance in Chrome Console in Meteor?

<template name="orderForm">

  {{> photographyServicesForm}}
  {{> videographyServicesForm}}
  {{> onlineProductsForm}}

</template>

If I go to the page orderForm, is there a way to get datainside the orderFormBlaze template instance when I am in the Chrome console? I know how to get it inside orderFormcallbacks, events, helpers and inside HTML, but I want to be able to easily check it and even update it from the Chrome console.

I also know that there are four different instances of the template when I move on to this orderForm. Obviously, this Template.orderFormdoes not work, because it is not the current instance of the template.

EDIT

Here is the answer:

<template name="orderForm">

  <div id="orderForm">
    {{> photographyServicesForm}}
    {{> videographyServicesForm}}
    {{> onlineProductsForm}}
  </div>

</template>

Blaze.getData($('#orderForm')[0])

It should be noted that the same data that is available in the template orderFormare also available for the child patterns - photographyServicesForm, videographyServicesForm,onlineProductsForm

+4
1

Blaze.getData Blaze.getView.

Blaze.getData :

Blaze.getData(document.querySelector('.someelement'))

, , .

+1

All Articles