jeudi 19 juillet 2018

checkbox should be false by clicking on dropdown values

I have one checkbox and dropdown,here for one dropdown value checkbox should be checked and for another value checkbox should be unchecked. In my case i will select checkbox first for one dropdown value and then I will select second dropdown value that time checkbox should be unchecked but in my case for second dropdown value my checkbox is still checked

Below is my code

HTML

 <p-dropdown [(ngModel)]="search.filter_type" [options]="filterTypes" (click)=GetOptions()>
            <ng-template let-item pTemplate="selectedItem">
              <span class="tbv-middle"></span>
            </ng-template>
 </p-dropdown>
        <p-checkbox [(ngModel)]="search.release_flag" binary="true" [label]="'RELEASED_OR_WORKING' | translate" [disabled]="EnabelDisable == true"></p-checkbox>

ts

GetOptions() {
    if (this.search.filter_type == "released") {
      this.EnabelDisable = true;
    }
    else {
      this.EnabelDisable = false;
    }
    if (this.search.filter_type == "up-to-date") {
      this.dateHide = true;
    }
    else {
      this.dateHide = false;
    }
  }

GetOptions() method is for hide and show checkbox.. here checkbox is disabled for filter_type == "released" but it should be unchecked




Aucun commentaire:

Enregistrer un commentaire