Mautic Community Forums

Using AngularJS for Mautic plugin interface

Okay, I have a plugin question for something we are building inside Mautic:



The front end builder is done in angularjs. You can only load angular once on a page, or nothing gets loaded. However Mautic changes the view with ajax and it doesn’t actually change the page so angular tries to load every time a different view is requested. Any idea how to only load it once? We tried multiple things such as to check if it’s loaded in a script tag and do document.write if not, but that seems to break mautic. Also tried checking if the request is ajax with $app->getRequest() but that runs in php and it executes first so it doesn’t help.

Any ideas?

Okay, I have a plugin question for something we are building inside Mautic:

The front end builder is done in angularjs. You can only load angular once on a page, or nothing gets loaded. However Mautic changes the view with ajax and it doesn’t actually change the page so angular tries to load every time a different view is requested. Any idea how to only load it once? We tried multiple things such as to check if it’s loaded in a script tag and do document.write if not, but that seems to break mautic. Also tried checking if the request is ajax with $app->getRequest() but that runs in php and it executes first so it doesn’t help.
Any ideas?