ionic-framework: Button inside input does not trigger ng-click

I have this markup:

<div class="list">
<div class="item item-input-inset">
<label class="item-input-wrapper">
<input type="text" name="search_input" placeholder="Contact name" ng-model="searchPhrase.name">
<button class="button-clear icon ion-close-circled" ng-click="resetSearch()"></button>
</label>
</div>
</div>

The idea was to have button part of the input element, but clicking on the button does not trigger function defined in ng-click. It does work when button is defined before the input field in the markup (but then all input field has that ng-click event registered). This is however not intended. I guess it has something to do with event listener registration.

So generally - how to handle this situation? Is that a correct way how to define button inside the input field?

About this issue

  • Original URL
  • State: closed
  • Created 10 years ago
  • Comments: 15 (2 by maintainers)

Most upvoted comments

I have the same problem but my major concern is the mobile app. I uses “on-tap” as the workaround.

Please do not place a button inside of a label which also contains an input. http://ionicframework.com/docs/components/#item-input-inset