我有一个图表指令。其中显示了一个uib tabset。我每次点击任何标签时都想重新加载。
<uib-tabset active="activePill" vertical="true" type="pills">
<uib-tab ng-repeat="physicalTest in patientinfo.physical_test_list"
index="$index" heading="{{physicalTest.name}}" disable="physicalTest.disabled">
<div class="row">
<div class="col-md-10">
<graph graph-data="physicalTest"></graph>
</div>
</div>
</uib-tab>
</uib-tabset>
答案 0 :(得分:0)
将指令包装在父HTML div或任何元素中。使用ng-if来隐藏和显示。单击选项卡时,将变量的值更改为切换显示/隐藏
<div ng-if="showDirectiveA">
<directive ...>
</div>
然后在标签
中<div id="tab" ng-click="showDirectiveA = !showDirectiveA">
根据您的代码,
<uib-tabset active="activePill" vertical="true" type="pills">
<uib-tab ng-repeat="physicalTest in patientinfo.physical_test_list" ng-click="physicalTest.showGraph = !physicalTest.showGraph" index="$index" heading="{{physicalTest.name}}" disable="physicalTest.disabled">
<div class="row">
<div class="col-md-10" ng-if="physicalTest.showGraph">
<graph graph-data="physicalTest"></graph>
</div>
</div>
</uib-tab>