Fetching via sending parameters to the template call
Initialize another HTL template that can then be called using data-sly-call:
<div data-sly-use.nav="navTemplate.html" data-sly-call="${nav.foo}"></div>
Passing/Sending parameter, use JavaScript Use-API
This is my HTL component:
<div data-sly-use.params="${'params.js' @ value1='feike', value2='visser', seperator=' '}">
${params.newValue}
</div>
Please note the ${‘ ’} notation used to define the Use-API that is called: using an HTL expression allows to specify options (everything that follows the “@” symbol), which will be passed as parameters to the Use-API.
This is in my HTL JavaScript logic file “params.js”:
use(function () {
// you can reference the parameters via the this keyword.
var retValue = this.value1 + this.seperator + this.value2;
return {
newValue: retValue
};
});
Source:- HTL and the JavaScript Use-API