ng-show在条件为false时隐藏元素的延迟

Delay in ng-show hiding elements when condition is false

本文关键字:隐藏 元素 延迟 false 条件 ng-show      更新时间:2023-09-26

我对AngularJS相当陌生,并且在我的应用程序中发生了这个问题。当我使用ng-show(甚至ng-hide)时,当条件为假时,元素隐藏会有延迟。这是一个很好的1秒延迟。

一个实例:因此,如果没有子域描述,按钮意味着立即隐藏…

<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>

找到问题。我在所有的按钮上都有一个过渡,像这样:

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

我也使用animation .css类animated fadeIn。当这些类被删除时,问题仍然存在,因为我在按钮上也有过渡。这是两者的结合。这是两者的结合。

那就是罪魁祸首。我真是个笨蛋!