How to pass data as parameter with block function in <script type=“text/x-magento-template”>?
-
14-04-2021 - |
Question
How to pass data as parameter with block function in below script:
<div class="col-sm-7 col-md-8 col-xs-9 col-lg-9 tag-content">
<h4><a target="_blank" class="title-store"
href="<?php echo $block->getBaseUrl() ?><%- data.rewrite_request_path %>"><%- data.store_name
%></a></h4>
<p class="address-store"><%- data.address %>, <%- data.zipcode %> <%- data.city %>, <?php echo $block->getCountryname(data.country_id); ?></p>
<p>
<span class="btn-link street-view">Street View</span>
<span class="btn-link direction">Direction</span>
</p>
</div>
In Above script, I am getting country code in this variable: data.country_id when I trying to pass this varibale as parameter with block function, like <?php echo $block->getCountryname(data.country_id); ?> but it's not working.
Please help me, how can I pass the parameter with block function in correct way and where I am doing the mistake.
Any help would be appreciated
Thanks!
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange