- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
我试图在加载数据时显示加载图标,然后在数据准备就绪时显示加载图标。问题是几秒钟后,我可以看到加载图标和数据...
这是我的代码
$scope.items[y].content.push({ text: '', loading: true });
API.getContent(id, x, y, function (response, x, y) {
$scope.items[y].content[x].loading = false;
$scope.items[y].content[x].text = response.data.text;
});
我的观点:
<i ng-show="item.loading" class="fa fa-spinner fa-pulse fa-2x"></i>
<p ng-hide="item.loading" class="portal-subtitle" ng-bind-html="item.text"></p>
我的内容是异步加载的。我一得到结果就将加载值设置为false,所以此时图标应该是不可见的……但事实并非如此! (如图所示)。
知道如何解决这个问题吗?
编辑:
我显示了我的“item.loading”的值。看起来当值从 true 变为 false 时,显示了文本,但图标仍然在这里几秒钟...这有帮助吗?
谢谢你的帮助
最佳答案
如果您使用的是 ng-animate,请将其添加到您的 CSS 中:
.ng-hide.ng-hide-animate{display: none !important; }
在 ng-hide 开始之前动画正在等待完成。
上面的 css 会在 ng-hide 和 ng-hide-animate 重合后立即隐藏元素。
关于javascript - 条件满足 ngShow AND ngHide,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37251825/
我有一个按钮,当数组 $scope.game.players.players 包含特定值时,我想隐藏该按钮。 button(ng-click="", ng-hide="ImPlaying()") Pl
我有几个基于范围属性显示文本的容器: [ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak{
我试图在加载数据时显示加载图标,然后在数据准备就绪时显示加载图标。问题是几秒钟后,我可以看到加载图标和数据... 这是我的代码 $scope.items[y].content.push({ text:
PO# [[inactive.poNumber]] 我想优化代码如果 getStatusIcon(inactive.currentStatus.code).statusDesc 是(过期,拒绝
我知道问这个问题绝对是愚蠢的,但我很好奇有没有办法做这样的事情: 0'> // shown 最佳答案 要添加@Josh David Miller 的答案,以下值在 Angular
当我登录我的应用程序时,我希望登录和注册按钮从导航中消失,所以如果登录成功并且从服务器收到 token ,我将使用 ng-hide 指令,我将其存储在 cookie 中. Nav 是 index.ht
我创建了无序列表,用户可以在其中单击和编辑(更新)元素。我在隐藏/显示 div 逻辑时遇到了一些问题。当用户单击编辑时我有 showItem div 和 editItem div 它显示 editIt
在这个 html 文件的页脚中,我有 3 个按钮。 第一张图片显示了 3 个按钮的排列方式。 第二张图片显示的是页脚中间按钮被注释掉的情况。 第三张图片是当中间按钮上的 ng-hide="true"时
http://plnkr.co/edit/cPyi8lukckyo9EFReI9V?p=preview 删除消失了,但当我点击复选框时却没有,知道我哪里出错了吗? {{task.name}
再次向大家寻求 AngularJS 的帮助。我正在构建一个 SPA,其中我的布局(主)页面分为三个部分,左侧导航栏、中心内容、右侧项目列表栏。当我加载主页时,我的右侧项目列表应该是隐藏的,但在其余屏幕
所以我有一个进度条,单击时将展开全屏,其中包含一些内容。我正在尝试 Angular 东西,但我似乎无法使关闭按钮切换功能正常工作。我在父级上有一个 ngClick,首先显示关闭按钮,效果很好!但是当我
我不明白为什么 ngShow 和 ngHide 指令不起作用。这是问题的简化版本。 content here content here 在 Controller 中 $scope.showConten
我用 material 在 angularjs 中创建了标签。我从一开始就隐藏了它的标签内容。如何使用某些动画在选项卡单击上显示内容。我的一些代码
我有一个带有 的 AngularJS 1.2.2 Web 应用程序我根据一些 $scope 显示/隐藏属性(property)。使用 ngAnimate模块,我动画显示和隐藏 . 我还有一门课我想
我有一些 angularjs ngHide 和 ngShow 代码。它们在 Chrome 中工作正常,但在 IE 中表现相反。代码如下: Section 1
Daño Global = 3" >
大家好! 我正在尝试让我的 Angular 5 应用程序隐藏元素(或显示隐藏元素)。然而,这似乎行不通。 我已经尝试过 ngHide、ng-hide、ngShow、ng-show、[hidden] 方
我是一个 DOM 元素(绑定(bind)到一个表)。我是基于 ngShow 的选项卡控件的下游子控件。我住在第二个选项卡上。当页面渲染时,我存在,但我还没有真正可见。 当我通过我的非直接父级变得可见时
所以我有两个独占的元素: foo bar 我向它们添加了 ngShow 和 ngHide: foo bar 但是现在当这些渲染时,它们都显示在一瞬间。 我怎样才能让它们同时显示/隐藏? 最佳答案 使用
我有一些元素希望在特定条件下可见。 在 AngularJS 中我会写 stuff 我如何在 Angular 2+ 中执行此操作? 最佳答案 hidden 属性可用于此 [hidden]="!myVar
我是一名优秀的程序员,十分优秀!