I want to include a helper myHelper
inside a link-to
expression like below but it seems you cannot have an expression directly inside another expression.
{{# link-to "someUrl" class="txt-dark-1 {{myHelper data}}"}} Some text {{/link-to}}
How could you include a helper function in this instance?
If you want to use the value of your helper directly, you can call your helper via ()
instead of {}
like this:
{{# link-to "someUrl" class="txt-dark-1" (myHelper data) }}
Some text
{{/link-to}}
If you want to concat another string value to your class attribute, you can use it via concat
helper like this:
{{# link-to "someUrl" class=(concat "txt-dark-1 " (myHelper data)) }}
Some text
{{/link-to}}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.