【问题标题】:why doesn't ng-show remove class ng-hide为什么 ng-show 不删除类 ng-hide
【发布时间】:2014-02-05 13:32:04
【问题描述】:

我需要显示和隐藏一个 div。我通过将假值的真值放入 ng-show 来做到这一点

<div  class="drawingToolPropertie" ng-show="{{ drawingMods.settingRoof}}">


<div  class="drawingToolPropertie" ng-show="{{ drawingMods.settingObs}}">

但这就是我得到的:

<div id="roofPropertie" class="drawingToolPropertie ng-hide" ng-hide="true">
<div id="ObstaclePropertie" class="drawingToolPropertie ng-hide" ng-hide="false">

values chage 但 ng-hide 类仍然存在,因此这些 div 始终被隐藏。我该如何解决 ?为什么这样工作?我没有使用 jquery。

【问题讨论】:

  • 它正在正常工作。 ng-show 只不过是否定 ng-hide 的糖。 ng-hide 属性的值很重要。

标签: angularjs


【解决方案1】:

ng-show/ng-hide 不使用双括号

ng-show="drawingMods.settingRoof"

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-10-18
    • 2016-02-17
    • 2014-12-08
    • 2014-03-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多