I need to show an alert after a route has been loaded by angularjs. The piece of code to show the alert is in the view loaded asynchronously by angularjs:
<script>
alert('test');
</script>
Once the view has loaded, I expect this to be run, but it does not. I know I can broadcast and tell it to run afterwards etc, but I need a more generic solution.
Assuming you are talking about route changes based upon
ngRoute
internal to an angular SPAInject $route into your controller:
and in your controller you subscribe to the event of the route changing:
There is one more option to run javascript function use
ngInit
call the function which is inside the controller