简体   繁体   English

条件为假时延迟ng-show隐藏元素

[英]Delay in ng-show hiding elements when condition is false

I'm rather new to AngularJS and am having this issue happening throughout my app. 我对AngularJS并不陌生,并且这个问题在我的整个应用程序中都在发生。 When I use ng-show (or even ng-hide ), when the condition is false, there's a delay in the element hiding. 当我使用ng-show (甚至ng-hide )时,当条件为false时,元素隐藏会有延迟。 It's a good 1 sec delay. 这是1秒的延迟。

One instance: So if there is not a subdomain description, the button is meant to hide...immediately. 一个实例:因此,如果没有子域描述,则该按钮应立即隐藏...。

<button
    class="btn btn-sm btn-primary pull-right animated fadeIn"
    title="Show Domain Info"
    ng-click="hideMe = !hideMe"
    ng-show="vm.subdomainDescription"
>
  <img src="assets/images/icon_info_circle.svg" class="icon-md" alt="Info">
</button>

Any help would be greatly appreciated. 任何帮助将不胜感激。

Found the issue. 找到了问题。 I have a transition on all the buttons like so: 我在所有按钮上都有一个过渡,如下所示:

.btn {
  position: relative;
  @extend .gotham-medium;
  border: 0;
  text-transform: uppercase;
  @include transition(background-color $transition-settings);
}

I was also using animate.css classes animated fadeIn . 我也使用了animate.css类的animated fadeIn When those classes where removed the problem persisted because I also have the transitions on the button. 当那些类被删除时,问题仍然存在,因为我在按钮上也有转换。 It was a combination of both. 这是两者的结合。 It was a combination of both. 这是两者的结合。

That was the culprit. 那是罪魁祸首。 What a knob I am :) 我是个好主意:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM