Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49083

How to Un-Select ion-segment Dynamically from ts file?

$
0
0

Hello all, I am try to use ion-segment-buttons as a filter, which i click and filter data. But i want to un-select the ion-segment when it is double tap’d to reset my data and make ion-segment ready to take ionChange Event.

I am able to reset but ion-segment-button it is still selected (highlighted), I want to unhighlight it.?

Please help…

Currently i am detecting events like this -

HTML

<ion-segment [(ngModel)]="category" (click)="FilterClick($event)" (ionChange)="FilterChanged($event)">
    <ion-segment-button class="custom-ion-seg-button" value="t1">
        <ion-icon name="car"></ion-icon>
        <ion-label class="filter-label">Filter 1</ion-label>
    </ion-segment-button>
    <ion-segment-button class="custom-ion-seg-button" value="t2">
        <ion-icon name="car"></ion-icon>
        <ion-label class="filter-label">Filter 2</ion-label>
    </ion-segment-button>
</ion-segment>

TS File

FilterClick(ev) {
    this.mouseClick++;
    if (this.mouseClick > 1) {
        console.debug("Reset Filter here and Remove Hightlight from Segment make it default");
    }
}

FilterChanged(ev) {
    console.log(ev)
    this.mouseClick = 0;

    let vehicle: any = ev.detail.value
    // make Filter data Available
    /// ...
}

Thanks,
Rahul

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 49083

Trending Articles



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