Skip to content

ionCancel trigger ionClear for ion-searchbar #9565

@LtotheWT

Description

@LtotheWT

Ionic version: (check one with "x")
[ ] 1.x
[ x] 2.1.13

I'm submitting a ... (check one with "x")
[ x] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Current behavior:

I am currently using ion-searchbar, when ionCancel function is called it will trigger the ionClear function.
when i then ionCancel function is called it will also call ionClear which makes it input become empty.

Expected behavior:

Suppose when i click on the ionCancel it will only not show the list.
Steps to reproduce:

Related code:

(ionCancel)="onCancel()"
 onCancel() { 
        // Not Show the list
        this.showList = false;
    }
(ionClear)="onClear($event)"
onClear(ev) { 
        // Show the results
        ev.target.value = '';
    }

Other information:

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

insert the output from ionic info here

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions