Ion Template Modal is not closing on view change. I also noticed, two instances of the "ion-autocomplete-container" on the view change. I have only one "ion-autocomplete-container" on my view page, why not the first one is deleted on view change.
`
`
I am using manage-externally attribute to handle when the search modal is shown. Two instances of "ion-autocomplete-container" are creating issues with the below code.
`var ionAutocompleteElement = document.getElementsByClassName("search");`
Could you please help me in this regard?
``
EDIT
Ionic dupicates some HTML elements in order to achieve smoother transitions.
For instance, in an ionNavBar it duplicates its content in 2 blocks such as these, and one only is visible except during transitions:
`
...
...
`
An element with an HTML ID/CSS Class will be duplicated. I believe having 2 elements with the same ID/Class in the DOM is forbidden in the HTML spec. Using document.getElementById/document.getElementByClass will only return one of these elements.
This is the reason why ionAutocompleteElement is not working. I tried to disable cache, but it did not work. Do you have a solution for this?
I need multiple instances of ion-autocomplete on a single page, I want to call them on button click. They are working well on page refresh, but on view change, click is not working because of multiple instances of the same code.
I don't think this error can be reproduced with codepen, we need to switch between multiple views to produce this error. Everything is working perfect on a single view or page load. Issue occur only on view change. I used a temporary fix to solve this issue:
Ion Template Modal is not closing on view change. I also noticed, two instances of the "ion-autocomplete-container" on the view change. I have only one "ion-autocomplete-container" on my view page, why not the first one is deleted on view change. `
EDIT Ionic dupicates some HTML elements in order to achieve smoother transitions. For instance, in an ionNavBar it duplicates its content in 2 blocks such as these, and one only is visible except during transitions: `
Hi @parveensaini5
I see your point but for what do you need to access the
search
element?Thanks and regards,
Guy
Hi,
I need multiple instances of ion-autocomplete on a single page, I want to call them on button click. They are working well on page refresh, but on view change, click is not working because of multiple instances of the same code.
Regards
Parveen
Hi @parveensaini5,
could you maybe create a codepen example which is reproducing this? And please follow this guide here to create an issue: https://github.com/guylabs/ion-autocomplete#guidelines-to-report-an-issue
Thanks and regards,
Guy
Hi
I don't think this error can be reproduced with codepen, we need to switch between multiple views to produce this error. Everything is working perfect on a single view or page load. Issue occur only on view change. I used a temporary fix to solve this issue:
if(ionAutoCompleteElement.length > 0) { angular.element(ionAutoCompleteElement[0]).removeClass("search")}
Thanks and regards
Parveen