ngIf不显示预期的输出

时间:2017-10-05 13:39:07

标签: html angular ionic-framework angular-ng-if

我在隐藏用户的内容方面遇到了问题。例如,从前1到3,用户的前1名是视觉的,前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'
    ">
.....

1 个答案:

答案 0 :(得分:0)

试试这个

array = [1, 2, 3, 4, 5]
def func(*args):
    return args

print func(array[0], array[1], array[2], array[3], array[4])