I have a question similar to this one, but different.
Here I am trying to add an event listener for a window.postMessage handler.
app.run(function ($
The accepted solution is not the appropriate way to do it. Ideally you shouldn't need to interfere with the digest cycle (which $apply() does).
The best way according to me is calling $location.path() from the MainController. Use $emit - $on to send it to the MainController and have a function call $location.path from there.
It will redirect you flawlessly without having to interfere with the digest cycle.
I hope this helps someone.