angular-google-places-autocomplete icon indicating copy to clipboard operation
angular-google-places-autocomplete copied to clipboard

Use clear search button

Open Rex90 opened this issue 8 years ago • 3 comments

I want to include an close icon in the search field to appear when there is text and tapping it to remove the text - any ideas how i can do this?

tried including this in the directive code but not sure how to link the icon to it

                function clearSearch() {
                  $scope.query = '';
                  clearPredictions();
                  $scope.input.focus();
                }

<label class="item item-input">
    <i class="icon ion-search placeholder-icon"></i>
    <input type="text" g-places-autocomplete ng-model="locationDetails"/>
    <a on-touch="clearSearch()"><i class="icon ion-close placeholder-icon"></i></a>
</label>

Rex90 avatar Jan 09 '16 14:01 Rex90

I also want to do this. Tried to set input value directly and through ng-model, nothing works.

abdulhafeez avatar Jan 15 '16 21:01 abdulhafeez

Also having this problem!

luisserota avatar Jan 18 '16 06:01 luisserota

Including an id in the input tag and then doing the following works:

document.getElementById('inputId').value = "";

Remember that using setValue does not work. Also, you will need to add the clear button outside of input tag.

abdulhafeez avatar Feb 16 '16 08:02 abdulhafeez