Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ng-cloak doesn't help for angular ui-router for hiding elements while template parsing

I'm using angular ui-router.

I want to show something if <div ng-show="total > 0">

While the template is downloaded and shown immediately we can see a flicker of the div, before the controller loads $scope.total =.

One would think that $scope.total is undefined in the beginning hence the div would be hidden, but I think the template isn't yet parsed, it's just shown raw. I tried using ng-cloak but it doesn't seem to help. Ngcloak is supposed to be used while angular is booting up, but I'm using ui-router so the angular stack is already loaded. How can I hide my elements on the template without resorting to ui-router resolves?

I'm using angular 1.2.8 and ui-router 0.2.7.

like image 562
Homan Avatar asked Jan 23 '14 07:01

Homan


1 Answers

PLease check this one, seems like solution to your problem.

https://stackoverflow.com/a/13276214/801354

like image 198
Ned Avatar answered Oct 19 '22 18:10

Ned