我在隱藏用戶內容時遇到問題。例如,從頂部1到3,用戶的頂部1是可視的,頂部2是口頭的。它應該顯示視覺和口頭的內容,但會隱藏第二部分。ngIf不顯示預期的輸出
如果從頂部1到3,我只有口頭但沒有視覺,它會顯示第二部分並隱藏第一部分。我究竟做錯了什麼?
//Hides content if user is Both visual and verbal
<div *ngFor="let styleElement of styles">
<ion-slides *ngIf="styleElement.first == 'Visual' || styleElement.second == 'Visual' || styleElement.third == 'Visual' ||
styleElement.first == 'Visual' && styleElement.second == 'Verbal' ||
styleElement.first == 'Visual' && styleElement.third == 'Verbal' ||
styleElement.second == 'Visual' && styleElement.first == 'Verbal' ||
styleElement.second == 'Visual' && styleElement.third == 'Verbal' ||
styleElement.third == 'Visual' && styleElement.first == 'Verbal' ||
styleElement.third == 'Visual' && styleElement.second == 'Verbal'
">
<ion-slide *ngFor="let slide of universeSlides">
<br>
<img [src]="slide.image" class="slide-image" />
</ion-slide>
</ion-slides>
</div>
//Hides this if user is only verbal
// the 2nd part im referring to
<div *ngFor="let styleElement of styles">
<div *ngIf="
styleElement.first != 'Visual' && styleElement.first != 'Verbal' ||
styleElement.first != 'Visual' && styleElement.second != 'Verbal' ||
styleElement.first != 'Visual' && styleElement.third != 'Verbal'
">
.....
你試過控制檯日誌記錄,以確保一切都如預期?你也可以嘗試在括號中包含一些條件。 – 2017-10-05 13:42:04