How to clean up the input search without hiding the keyboard?

that’s my question, every time I clean up the input, the keyboard disappears and I don’t want that

    <ion-header-bar ng-show="searchBoxEnabled">
      <div>
        <input type="search"
               ng-model="query">
        <div ng-show="query"
             ng-click="query=''"> <!--must ONLY clean the input, but is
                                      also disappearing the keyboard-->
        </div>
      </div>
      <!--must clean the input and disappear the keyboard,
          this one is working properly-->
      <div ng-click="hideSearchBox(); query=''">
        |Cancel
      </div>
    </ion-header-bar>

and in the javascript side I have this couple functions in order to show and hide the input

    $scope.showSearchBox = function() {
      $scope.searchBoxEnabled = true;
    };

    $scope.hideSearchBox = function() {
      $scope.searchBoxEnabled = false;
    };

If you change the value of your model -> the $scope is refreshing and you lose the focus in your input and then the keyboard gets hidden.

Try to set the focus to the input field again maybe the keyboard stays open… but maybe you get a ugly hide and show effect of the keyboard.