I have an SPA in AngularJS which loads different templates into a single SPA.
After reading this https://developers.google.com/web/fundamentals/performance/critical-rendering-path/measure-crp?hl=en I included a onload="measureCRP()" in the body of the SPA, which is basically something like this
<body onload="measureCRP()">
<div ng-app="app">
<div ng-view></div>
</div>
</body>
and I can see every time the page is loaded the time spent in building the DOM and the overall load time for the page.
But of course, when the view is updated then this is not updated. I thought about including something similar in all templates, but it doesn´t seem to work.
Any ideas in how this should be done?
EDIT.
I tried including the onload as suggested in this other post Angular js ng-view rendered event
<body>
<div ng-app="app" ng-controller="SpaController as spa">
<div ng-view onload="spa.measureCRP()"></div>
</div>
</body>
but although the function measureCRP() is executed again, the values displayed are exactly the same everytime, so my guess is that the timestamps collected remain the same. Thanks