2017-06-19 55 views
0

在我的頁面中,我有三個選項卡,在我的第三個選項卡中,我使用了ng-select標籤。我只想顯示1.ng選擇標籤,其他標籤即2.和3.應該隱藏,直到我選擇我的1.標籤中的數據。下面是引用Click Here To Display The Image的PIC這裏是我的代碼如何在Angular2中隱藏數據?

<ng-select [options]="options" class='filterDropDown' placeholder="Choose campaigns" [allowClear]="false" [multiple]='false' name="selectedCampaigns" style="width: 92%;margin-left: 10px;"> 
        </ng-select> <br/> 
        <ng-select [options]="options" class='filterDropDown' placeholder="Choose campaigns" [allowClear]="false" [multiple]='true' name="selectedCampaigns" style="width: 92%;margin-left: 10px;" [hidden]="selectedCampaigns"> 
        </ng-select> 
        <ng-select [options]="options" class='filterDropDown' placeholder="Choose campaigns" [allowClear]="false" [multiple]='true' name="selectedCampaigns" style="width: 92%;margin-left: 10px;" [hidden]="selectedCampaigns"> 
        </ng-select> 
        <button class="btn submitLogo" style="margin-top:15px;" (click)="compare()">Compare</button> 

回答

2

我會用([ngModel])*ngIf做到這一點。

<ng-select ([ngModel])=tab1 </ng-select> 
<ng-select ([ngModel])=tab2 *ngIf="tab1" </ng-select> 
<ng-select ([ngModel])=tab3 *ngIf="tab1" </ng-select> 

就是這樣的。

+0

其工作,謝謝。 –