I'm trying to execute a function that gives an alert on the screen after it is loaded, however, I'm not having success with ng-init because using ng-init it gives the alert and the screen goes blank and only click after clicking the 'OK' button. Is there a way to execute a function only after the content of ng-view has been loaded?