I have a page that contains of widgets.
Widget is object with settings & templateUrl where I bind these settings, so I build my page compiling these settings using $compile service via directive. This is how I render in view:
<div ng-repeat="widgetObj in myWidgets" compile="widgetObj">
<div><i class="fa fa-circle-o-notch fa-spin"></i></div>
</div>
When widget is compiled, it is added in the inner div instead of loading icon.
Problem:
I have to render html from widgetObj and send compiled html to server as string. One solution that I found was to compile widget as I normally do, but in hidden div and when it is compiled i take that HTML and send it. With this solution everything is fine (mostly), but the problem occurs when I want to render multiple pages (5+). My chrome starts freezing and memory usage goes 1,2 GB+.
I know that using $compile & working with DOM in controller is not the best solution, but for my task I need compiled html.
Hopefully you can suggest me something considering my problem or maybe give hint for a better solution. Currently I am looking forward to background workers, but not sure if it is even possible considering this approach.