1

I have an angularjs app. In the html page I call some REST services when the page is loading. I want to calculate the time taken in loading the page.

I found below code at Calculating Page Load Time In JavaScript:

window.onload = function () {
    var loadTime = window.performance.timing.domContentLoadedEventEnd-window.performance.timing.navigationStart; 
    console.log('Page load time is '+ loadTime);
}

But it uses window.onload.

Which angularjs directive should I use to execute this logic after the page load is done.

Thanks.

Community
  • 1
  • 1
deadpool
  • 314
  • 1
  • 4
  • 10

1 Answers1

4
angular.element(document).ready(function(){
//do it here
});
anaval
  • 1,130
  • 10
  • 24