how to call shared helper inside another shared helper
-
Hi sir,
how to call shared helper inside another shared helper . I have import helper using asset but it throws error.
Like this,
{#asset Transportation_Mode_Helper.js}The error is,
-
template
{{helpers1}}
asset helpers1.js
marked as shared helpersconst Handlebars = require('handlebars') function helpers1() { return Handlebars.helpers.helpers2() }
asset helpers2.js
marked as shared helpersfunction helpers2() { return 'helpers2' }
Complete demo
https://playground.jsreport.net/w/anon/CpxGqYmz
-
But in my case i want to call helper A,helper B,helper c in helper d and call this helper in template script file.
Also helper A,B,C have multiple funtions
Inside script file i used to call shared helper like this,
(I tried to call shared helper from another helper using asset
{#asset Transportation_Mode_Helper.js}
But it throw error .)In your example your are call a function in helper not by using helper.js name.So if multiple helper have same function this wont work.
-
and call this helper in template script file.
you mean in the
<script></script>
tag. Or in the helpers section?
-
in helper class .That means calling helper A,B,C in helper class D .This is my scenario.
Because i want to access both function A1 from helper A class and function B1 from helper B class in helper class D.
-
This could help
https://playground.jsreport.net/w/anon/~r9sVLqj
https://jsreport.net/learn/assets#require-asset
-
Thank you sir