如何基于角度6中两个类别的选择显示数据?

时间:2018-11-08 19:34:47

标签: html css angular6

我的html代码:

<ul style="list-style:none">
          <li  (click)="submitls();"><i class="fa fa-hospital-o first"
                aria-hidden="true"></i><a routerLink="/">LS</a></li>
<li  (click)="submitlsp();"><i class="fa fa-hospital-o first"
                aria-hidden="true"></i><a routerLink="/">LSP</a></li>
 </ul>

同样,我在列表中还有另外5个选项。

和导航栏菜单,

<div class="row">
 <div class="col-xs-6 col-sm-6 col-md-4 col-lg-2">
          <button type="submit"  id="category1" (click)="changeCat1();">
            <img [src]="path" alt="image not found" class="icon">
            category1
          </button></div>
  <div class="col-xs-6 col-sm-6 col-md-4 col-lg-2">
          <button type="submit"  id="category2" (click)="changeCat2();">
            <img [src]="path" alt="image not found" class="icon">
            category2
          </button></div>

所以,这里我还有另外3个类别。基于LS和类别1的选择,我需要显示一些数据,然后基于LSP和类别1的选择,我需要显示一些数据。

我的打字稿文件:

submits(){
    this.showls = true;
    this.changeCat1();
    this.showHlsTransformationpoc();

}
changeCat1(){
    this.showCat1 = true;
    this.showlspoc();
}
changeCat2(){
    this.showCat2 = true;
    this.showlspoc();
}

showlspoc(){
   this.showls_poc_flag = false;
    this.ls_cat2poc_flag = false;
     if(this.showls == true && this.showCat1 == true){
        this.showls_poc_flag = true;
    }
    else if(this.showls == true && this.showCat2== true){
        this.ls_cat2poc_flag = true;
    }
  }

因此,对于每个类别,我都需要这样做吗?另外,如果我给出这样的其他条件,则它不起作用。有人可以帮我吗?

0 个答案:

没有答案