Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70429

Implement clear button for ion-select with a multiple values

$
0
0

@filippodicostanzo wrote:

I have a multiple select.
How I can implement the reset button for the select and show the blank value?

 <ion-item>
      <ion-label>
        <i class="fa fa-tags" aria-hidden="true"></i>{{'Categories' | translate}}</ion-label>
      <ion-select [(ngModel)]="categories" multiple="true" (ionCancel)="allClickedCategories()" [okText]="('Select' | translate)"
        [cancelText]="('Select All' | translate)" [selectOptions]="selectOptions">
        <ion-option *ngFor="let item of categoriesitems" value="{{item.name}}">{{item.name | translate}}</ion-option>
      </ion-select>
    </ion-item>


      <ion-col col-6 class="center">
        <button ion-button (click)="buttonReset()">Reset</button>
      </ion-col>


      <ion-col col-6 class="center">
        <button ion-button (click)="buttonClicked()">{{'Search' | translate}}</button>
      </ion-col>

I try to implement the button reset with the code below: in the select i see the value but the array is empty

image

  buttonReset() {
    this.categories = [];
  }

Thank You

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70429

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>