【发布时间】:2017-10-05 13:39:07
【问题描述】:
我在向用户隐藏内容时遇到了问题。例如,从top 1到3,用户的top 1是视觉的,top 2是口头的。它应该显示视觉和口头的内容,但会隐藏第二部分。
如果从前 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'
">
.....
【问题讨论】:
-
您是否尝试过控制台日志记录以确保一切都按预期进行?您也可以尝试将一些条件句括在括号中。
标签: html angular ionic-framework angular-ng-if