# First attempt with ionic fail a simple click

**URL:** <https://forum.ionicframework.com/t/first-attempt-with-ionic-fail-a-simple-click/4789>\
**Category:** ionic-v1\
**Created:** [May 26, 2014, 4:50pm UTC](https://forum.ionicframework.com/t/first-attempt-with-ionic-fail-a-simple-click/4789 "2014-05-26T16:50:45Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![abmcr](https://avatars.discourse-cdn.com/v4/letter/a/35a633/32.png) [@abmcr](https://forum.ionicframework.com/u/abmcr)\
**Post date:** [May 26, 2014, 4:50pm UTC](https://forum.ionicframework.com/t/first-attempt-with-ionic-fail-a-simple-click/4789/1 "2014-05-26T16:50:46Z")

</div>

I have made a simple edit to the standard tab app: my purpose is to filter data of the list.  
I have edit the original markup with this code

```
<div class="list list-inset">
            <label class="item item-input">
                <i class="icon ion-ios7-search placeholder-icon"></i>
                <input type="search" placeholder="Ricerca..." ng-model="searchQuery" />
                <i class="clear-search icon ion-ios7-close-empty" ng-click="clearSearch()"></i>
            </label>
        </div>

```

and in the list i have add the filter as

```
<ion-item ng-repeat="friend in friends | filter: searchQuery" type="item-text-wrap" href="#/tab/friend/{{friend.id}}">
    {{friend.name}}
  </ion-item>
</ion-list>

```

In the controller i have add a simple function

```
   .controller('FriendsCtrl', function($scope, Friends) {
    $scope.friends = Friends.all();
    //for reset filter
    $scope.clearSearch = function() {
        $scope.searchQuery = '';
    };
}) 

```

but if the filter work fine, the clearSearch function don’t work: i have added a console.debug(‘ok’)… but the event don’t fire

Please excuse my poor english … and the very newbie question  
Thank you in advance

---

<div class="post-metadata">

**Author:** ![notmatt](https://avatars.discourse-cdn.com/v4/letter/n/f6c823/32.png) [@notmatt](https://forum.ionicframework.com/u/notmatt)\
**Post date:** [May 26, 2014, 5:16pm UTC](https://forum.ionicframework.com/t/first-attempt-with-ionic-fail-a-simple-click/4789/2 "2014-05-26T17:16:09Z")

</div>

Could you turn it into a codepen? (try using one of the templates [here](http://codepen.io/ionic/public-list/))

---

<div class="post-metadata">

**Author:** ![abmcr](https://avatars.discourse-cdn.com/v4/letter/a/35a633/32.png) [@abmcr](https://forum.ionicframework.com/u/abmcr)\
**Post date:** [May 27, 2014, 9:13am UTC](https://forum.ionicframework.com/t/first-attempt-with-ionic-fail-a-simple-click/4789/3 "2014-05-27T09:13:09Z")

</div>

This is the codePen

> **[List: 1.0.0-beta.4](https://codepen.io/abmcr/pen/GfjvI?editors=101)**
>
> An Ionic list directive Forked from \[Ionic\](/ionic)'s Pen \[List: 1.0.0-beta.4\](/ionic/pen/JsHjf/)....

Thank you

---

<div class="post-metadata">

**Author:** ![maximilian](https://avatars.discourse-cdn.com/v4/letter/m/d6d6ee/32.png) [@maximilian](https://forum.ionicframework.com/u/maximilian)\
**Post date:** [May 27, 2014, 11:32am UTC](https://forum.ionicframework.com/t/first-attempt-with-ionic-fail-a-simple-click/4789/4 "2014-05-27T11:32:17Z")

</div>

I think this might be a problem with the icon being inside of the input. Check [this](http://codepen.io/anon/pen/AxwFv?editors=101) out. I put an additional icon below the input which successfully clears searchQuery. I assume that inside the input the input itself and not the icon will receive the click event. Maybe you could try something like [this](http://ionicframework.com/docs/components/#item-input-inset).

---

<div class="post-metadata">

**Author:** ![notmatt](https://avatars.discourse-cdn.com/v4/letter/n/f6c823/32.png) [@notmatt](https://forum.ionicframework.com/u/notmatt)\
**Post date:** [May 27, 2014, 1:46pm UTC](https://forum.ionicframework.com/t/first-attempt-with-ionic-fail-a-simple-click/4789/5 "2014-05-27T13:46:12Z")

</div>

Yeah I think it has to do with the inline button being covered by the list-inset input.

Here is a working (but ugly) example based off the collection-repeat example on Ionic’s Codepen repository: [http://codepen.io/anon/pen/hxoyD](http://codepen.io/anon/pen/hxoyD)

---

<div class="post-metadata">

**Author:** ![abmcr](https://avatars.discourse-cdn.com/v4/letter/a/35a633/32.png) [@abmcr](https://forum.ionicframework.com/u/abmcr)\
**Post date:** [June 11, 2014, 5:43pm UTC](https://forum.ionicframework.com/t/first-attempt-with-ionic-fail-a-simple-click/4789/6 "2014-06-11T17:43:11Z")

</div>

I have edit the codepen for try with a simple search function

> **[List: 1.0.0-beta.4](https://codepen.io/anon/pen/cytqp?editors=101)**
>
> An Ionic list directive Forked from \[Ionic\](/ionic)'s Pen \[List: 1.0.0-beta.4\](/ionic/pen/JsHjf/). Forked from \[Andrea\](/abmcr)'s Pen \[List: 1.0.0-be...

The filter don’t work: i think the error is in the line 6 of the js… the item parameter may be incorrect?

Thank you in advance
