Skip to content
This repository was archived by the owner on May 4, 2022. It is now read-only.

<ion-searchbar> (ionClear) is calling twice #163

@ionitron-bot

Description

@ionitron-bot

Original issue by @Bloggerschmidt on 2017-01-11T14:13:22Z

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

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:

Clicking the clear button in <ion-searchbar> (the x at the end) (ionClear) is calling a function twice (for the event types 'mousedown' and 'click').

Expected behavior:

(ionClear) should call only once (for event type 'click' or (!) 'mousedown')

Steps to reproduce:

ionic start --v2 myApp blank

Related code:

home.html

<ion-header>
  <ion-navbar>
    <ion-title>
      Ionic Blank
    </ion-title>
  </ion-navbar>
</ion-header>

<ion-content padding>
<ion-searchbar 
    primary 
    [(ngModel)]="address" 
    (ionClear)="clearSearch($event)"
></ion-searchbar>
</ion-content>

home.ts

import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';

@Component({
    selector: 'page-home',
    templateUrl: 'home.html'
})
export class HomePage {

    address = '';

    constructor(public navCtrl: NavController) {
    }

    clearSearch(e) {
        console.log('clearSearch', e);
    }

}

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

Cordova CLI: 6.4.0 
Ionic Framework Version: 2.0.0-rc.4
Ionic CLI Version: 2.1.18
Ionic App Lib Version: 2.1.9
Ionic App Scripts Version: 0.0.47
ios-deploy version: 1.9.0 
ios-sim version: 5.0.13 
OS: macOS Sierra
Node Version: v7.4.0
Xcode version: Xcode 8.2.1 Build version 8C1002

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions