ng-cloak不能帮助有角度的ui-router在模板解析时隐藏元素 [英] ng-cloak doesn't help for angular ui-router for hiding elements while template parsing
问题描述
我正在使用角度ui路由器.
I'm using angular ui-router.
如果<div ng-show="total > 0">
在下载模板并立即显示模板的同时,我们可以看到在控制器加载$scope.total =
之前div的闪烁.
While the template is downloaded and shown immediately we can see a flicker of the div, before the controller loads $scope.total =
.
人们会认为$scope.total
在开始时是未定义的,因此div将被隐藏,但是我认为模板尚未解析,只是显示为原始.我尝试使用ng-cloak,但似乎无济于事.应该在angular启动时使用Ngcloak,但是我使用的是ui-router,因此已经加载了angular堆栈.如何在不借助ui-router解析的情况下将元素隐藏在模板上?
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?
我正在使用angular 1.2.8和ui路由器0.2.7.
I'm using angular 1.2.8 and ui-router 0.2.7.
推荐答案
请检查这一点,似乎可以解决您的问题.
PLease check this one, seems like solution to your problem.
https://stackoverflow.com/a/13276214/801354
这篇关于ng-cloak不能帮助有角度的ui-router在模板解析时隐藏元素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!