gpt4 book ai didi

javascript - Angular ng-hide 还是 ng-show ?为什么?

转载 作者:行者123 更新时间:2023-11-28 11:48:41 25 4
gpt4 key购买 nike

我已经多次看到这个问题,但没有一次看到正常的答案。

ng-hide 和 ng-show 有什么区别?有吗?如果是这样,何时使用其中之一(我理解 ng-if,我只询问这两个)。

希望有人知道谢谢。

最佳答案

The ngShow directive shows or hides the given HTML element based on the expression provided to the ngShow attribute.

The element is shown or hidden by removing or adding the .ng-hide CSS class onto the element. The .ng-hide CSS class is predefined in AngularJS and sets the display style to none (using an !important flag).

ngHide当您需要反转表达式的结果时,它只是语法糖。

基本上,使用 ng-show="!testSomething()"ng-hide="testSomething()" 是一样的。

关于javascript - Angular ng-hide 还是 ng-show ?为什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41802147/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com