I am trying to work out the best way to call a function inside an AngularJS controller, from outside the controller.
We are using a Python backend, which sends back data to the frontend via JavaScript functions. I am using this at the moment to send that data into the Angular controller...
function myFunction(var1, var2) {
angular.element($('body')).scope().insideFunction(var1, var2);
}
This works very well, but I'm just wondering if this is the best way to do this.
Edit: I have rolled with this, and have about 8 of these "outside scope" functions working fine. The data simply gets passed from Python > JS function > Angular function.
If anyone has a better method of doing this, I would love to hear it.