Seeking guidance on the best way to convert HTML from JSON into a trigger for a modal/toggle upon clicking.
Within the JSON data consisting of 100 entries, there are about 10 links that need to activate a pop-up when clicked. These links are displayed as 'Schedule #' (where # ranges from A to G).
My initial approach involves embedding Angular mark-up directly in the JSON and then rendering it into the scope:
Extract from JSON:
"Are the details defined in
<a href='/#/' class='schedule'
data-ng-click='modal.active = modal.active === true ? false : true'>
Schedule G
</a>?"
However, this method is not effective because angular does not recognize the ng-click or the modal directives. While $sce successfully handles trustAsHTML, the expression remains unrecognized.
Am I headed in the right direction?
I have explored $apply, $compile, and $parse documentation but none of them seem to align with my current approach.
Alternatively, would it be more efficient to use regex to identify the 'Schedule' text and then dynamically construct the Angular expression? I am struggling to find a suitable method for tackling this task.