I have a page with some tabs and each tab has large amount of angularjs bindings.This is sample page where i am facing issue.Each tabs take about 10 seconds to render.
You can change your code like this:
$timeout(function() {
$scope.currentTab = tab.url
}, 100);
Demo: http://jsfiddle.net/eRGT8/1053/
What I do is, I push currentTab
change to next digest cycle. (It's some kind of a hack, not a solution I proud of.) Therefore, in first digest cycle (before $timeout
invoked) only loading is shown. In the next digest cycle, the blocking ng-repeat
stuff starts working but since we make loading visible previously, it appears.
:)
This solves your problem, but running long running and blocking javascript that hangs browser completely is not a good user experience. Also, since browser is hang completely, the loading gif will not animate, only will be visible.