How to display data based on the selection of two categories in angular 6?











up vote
0
down vote

favorite












My html code:



<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>


Likewise I am having another 5 options in list.



And Navbar menu,



<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>


So, here I have another 3 categories also. Based on the selection of LS & category1 I need to display some data, Then based on the selection of LSP & category 1 I need to display some data.



My typescript file:



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;
}
}


So do I need to do like this for every category & also if I give another condition like this, it is not working. Can somebody help me with this please?










share|improve this question




























    up vote
    0
    down vote

    favorite












    My html code:



    <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>


    Likewise I am having another 5 options in list.



    And Navbar menu,



    <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>


    So, here I have another 3 categories also. Based on the selection of LS & category1 I need to display some data, Then based on the selection of LSP & category 1 I need to display some data.



    My typescript file:



    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;
    }
    }


    So do I need to do like this for every category & also if I give another condition like this, it is not working. Can somebody help me with this please?










    share|improve this question


























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      My html code:



      <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>


      Likewise I am having another 5 options in list.



      And Navbar menu,



      <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>


      So, here I have another 3 categories also. Based on the selection of LS & category1 I need to display some data, Then based on the selection of LSP & category 1 I need to display some data.



      My typescript file:



      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;
      }
      }


      So do I need to do like this for every category & also if I give another condition like this, it is not working. Can somebody help me with this please?










      share|improve this question















      My html code:



      <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>


      Likewise I am having another 5 options in list.



      And Navbar menu,



      <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>


      So, here I have another 3 categories also. Based on the selection of LS & category1 I need to display some data, Then based on the selection of LSP & category 1 I need to display some data.



      My typescript file:



      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;
      }
      }


      So do I need to do like this for every category & also if I give another condition like this, it is not working. Can somebody help me with this please?







      html css angular6






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 8 at 23:15







      user9096175

















      asked Nov 8 at 19:34









      Priyanka

      36




      36





























          active

          oldest

          votes











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53214926%2fhow-to-display-data-based-on-the-selection-of-two-categories-in-angular-6%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown






























          active

          oldest

          votes













          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53214926%2fhow-to-display-data-based-on-the-selection-of-two-categories-in-angular-6%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Schultheiß

          Verwaltungsgliederung Dänemarks

          Liste der Kulturdenkmale in Wilsdruff