javascript - Angular JS fast resolve and slow controller page is empty while the data loads -


i have main.html . name card , system detail going remain constant , content keep on changing depending upon view .

        <div ui-view="namecard"></div>         <div ui-view="systemdetail"></div>         <div ui-view="content"></div> 

im using ui route routing . when switch 1 view other , resolve happens first (the page loads first here), followed controller initialization , loads data . due lazy controller , users left view @ blank page while. , how should add spinner logic user left view @ spinner till data loads. when clicks on button want enable spinner before resolve happens , hide spinner after post has happened .shoud ass in main.html or should add in content page

you can enable spinner on state change

$scope.$on('$viewcontentloaded', function(){   // add show spinner code here }); 

and disable when content load

$scope.$on('$viewcontentloaded', function(){   // add hide spinner code here }); 

Comments

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -