I've got a view that I load which contains a substantial number of images (between 100-200 typically), so this can take around 5 seconds to fully load / render, so I want to add a loading indicator during that time.
My problem is, I can't seem to find a reliable way of knowing when to present the view and hide the loading indicator. Previously, I'd used this piece of [jQuery] code to achieve this:
$(window).load(function() {
$('.loading-notice').fadeOut(300, function () {
$('.library-thumbnails').fadeIn(1000);
});
});
Which worked great - however this isn't usable when loading a view in via Angular.js it seems.
I've got my Angular.js template and controller setup fine to do the fading in and out in the same style of which I did using jQuery, but I just can't detect when the images have all finished loading is all - I can only seem to detect when the JSON is returned from the server that will be used in the model.
EDIT I should have mentioned, I also tried using $viewContentLoaded as per below, however this is called before the images finish loading.
$scope.$on('$viewContentLoaded', function () {
console.log('$viewContentLoaded');
});