Hi Team,
I am exploring new template directives feature introduced in APEX 20.2. I am trying to get HTML output using applyTemplate JavaScript method. It's working for basic if-else directives without any error, but not working for loop directive. It's throwing below error.
Uncaught TypeError: apexModel is undefined
loop https://static.oracle.com/cdn/apex/20.2.0.00.20/libraries/apex/util.js?v=20.2.0.00.20:1588
processToken https://static.oracle.com/cdn/apex/20.2.0.00.20/libraries/apex/util.js?v=20.2.0.00.20:2131
applyTemplate https://static.oracle.com/cdn/apex/20.2.0.00.20/libraries/apex/util.js?v=20.2.0.00.20:2271
<anonymous> debugger eval code:1
I have created a page with "Checkbox Group" item. I just want to loop through selected items using template directives syntax.
Steps to reproduce above error:
Click on this demo link - https://apex.oracle.com/pls/apex/hari/r/template-directives/home
Select one or more countries
In browser console, execute below JavaScript code
apex.util.applyTemplate('{loop P1_COUNTRIES/}&APEX$ITEM.{endloop/}');
Above code throws error.
Below simple if-else directive works with out error. But, there is still some issue with below code. Countries list won't display as separated by colon, instead null is displayed in place of colon.
apex.util.applyTemplate('{if P1_COUNTRIES/}&P1_COUNTRIES.{else/}No Countries Selected.{endif/}');
Looks like I am missing something obvious here. Can some help me in right direction? Thank you.