可见性隐藏在AngularJs

可见性隐藏在AngularJs

本文介绍了可见性隐藏在AngularJs?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<button id="tagBtnId" name="TagsFilter" ng-show="disableTagButton">Tags</button>

NG-节目适用显示:无显示:块属性,但我要应用 visibility:hidden的可见性:可见属性

ng-show applied display: none or display: block property But I want to applied visibility: hidden and visibility: visible property.

推荐答案

您可以使用纳克级 NG-风格指令如下

纳克级这将增加类 MyClass的的按钮时仅 disableTagButton 诚然,如果 disableTagButton 为false,则 MyClass的将从按钮删除

ng-class this will add class myclass to the button when only disableTagButton is true , if disableTagButton is false then myclass will remove from the button

<button id="tagBtnId" name="TagsFilter" ng-class="{'myClass': disableTagButton}">Tags</button>

<style>
   .myClass {
       visibility: hidden
    }
</style>


NG-风格

<button id="tagBtnId" name="TagsFilter" ng-style="disableTagButton">Tags</button>

那么你的 disableTagButton 应该是这样

$scope.disableTagButton = {'visibility': 'hidden'}; // then button will hidden.

$scope.disableTagButton = {'visibility': 'visible'}; // then button will visible.

,这样你们可以通过改变改变按钮的能见度 $ scope.disableTagButton

这篇关于可见性隐藏在AngularJs?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-31 00:06