Angular ui router选项卡 - 激活时隐藏div

时间:2017-03-09 16:33:47

标签: javascript angularjs angular-ui-router angular-ui-bootstrap

仅在特定标签上显示/隐藏标签内容之外的div的最简单方法是什么?我当前的例子显示但我无法再隐藏它。

Plunker:http://plnkr.co/edit/E6dK5C9ZxVQaicQgfS4w?p=preview

  <div class="border" ng-show="aboutTabActive == true">Show me when the "About Tab" is clicked.</div>

  <!-- NAVIGATION -->
  <nav class="navbar navbar-inverse" role="navigation">
      <div class="navbar-header">
          <a class="navbar-brand" ui-sref="#">AngularUI Router</a>
      </div>
      <ul class="nav navbar-nav">
          <li><a ui-sref="home">Home</a></li>
          <li><a ui-sref="about" ng-click="aboutTabActive=true">About</a></li>
      </ul>
  </nav>

  <!-- MAIN CONTENT -->
  <div class="container">
      <div ui-view></div>
  </div>

1 个答案:

答案 0 :(得分:1)

<ul class="nav navbar-nav">
          <li><a ui-sref="home" ng-click="aboutTabActive=false">Home</a></li>
          <li><a ui-sref="about" ng-click="aboutTabActive=true">About</a></li>
      </ul>