Execute function after loading page with Angularjs

1

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?

    
asked by anonymous 26.04.2016 / 16:28

1 answer

1

According to documentation :

$scope.$on('$viewContentLoaded', function(){
    //Executar depois de carregado
});
    
26.04.2016 / 22:56