[英]How to hide and show the same element in Angular.js
I've just started using Angular.js for a side project of mine, but I've come to a point where I'm really, really stuck. 我刚刚开始将Angular.js用于我的一个副项目,但到现在我确实真的很受困。 I want a html element to be clicked on, replaced by a loading bar and come back after the loading's finished. 我希望单击一个html元素,由一个加载栏代替,并在加载完成后返回。
I've tried using ng-hide
and ng-show
, but it only works if I have something like this: 我已经尝试使用ng-hide
和ng-show
,但是只有在我有这样的东西时,它才有效:
<a href="" ng-click="click = !click" ng-hide="click">{{action}}</a> <a href="#" ng-click="click = !click" ng-show="click">Undo</a>
Is this a way to accomplish dynamic showing/hiding through pure Angular? 这是通过纯Angular完成动态显示/隐藏的一种方法吗? I'm trying to find solutions before I have to resort to Jquery. 我试图在不得不诉诸Jquery之前找到解决方案。
Thanks in advance 提前致谢
ng-hide
and ng-show
are the right way to do that. ng-hide
和ng-show
是执行此操作的正确方法。
Take a look on angular-spinner too. 也来看看角度旋转器 。 It coulds help you. 它可以帮助您。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.