My Angular application requires customizable reporting functionality. The goal is to permit users to select from a variety of available reports, with a backend REST API providing both the template and data in JSON format for user customization.
The app will then need to insert the template into a "reporting" view page and populate it with the provided data using Angular's compilation process for display.
Although I've explored using ng-include, it only supports URLs or file paths, which are not suitable for my needs as the template text is retrieved dynamically via the REST service. If ng-include could accept template text directly, that could potentially solve the issue, but unfortunately it does not.
I attempted to create a directive to handle this task, calling a method (getTemplate()) to load the fetched template from the scope. However, it seems my directive does not have access to the necessary scope for this operation.
What approach should I take to achieve this functionality? While a directive seems like the best solution, I am struggling to implement it correctly, feeling overwhelmed by the documentation and numerous failed attempts.