简体   繁体   中英

Angular Bootstrap if tab is active, hide external div

Is there a way to detect if a specific tab is active and then hiding a div outside all tabs when it is active?

Plunker: https://plnkr.co/edit/b9O9S7JxxgzhQKcKONkn?p=preview

  <div class="border">
    Hide me when Tab #3 is active.
  </div>
  <hr>
  <form name="outerForm" class="tab-form-demo">
    <uib-tabset active="activeForm">
      <uib-tab index="0" heading="Tab #1">
        <ng-form name="nestedForm">
          <div class="form-group">
            <label>Name</label>
            <input type="text" class="form-control" required ng-model="model.name"/>
          </div>
        </ng-form>
      </uib-tab>
      <uib-tab index="1" heading="Tab #2">
        Some Tab Content
      </uib-tab>

      <uib-tab index="2" heading="Tab #3">
        More Tab Content
      </uib-tab>

    </uib-tabset>
  </form>

Use ng-hide to your functionality like

<div class="border" ng-hide="activeForm==2">
    Hide me when Tab #3 is active.
</div>

Working plunker

you can simply use the value of activeForm, which stores the value of the index(tab)

<div class="border" ng-show="activeForm != 2" >
    Hide me when Tab #3 is active.
  </div>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM