Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple instances of "ion-autocomplete-container" on view change #210

Open
goclixy-core opened this issue Oct 24, 2016 · 5 comments
Open
Assignees
Labels
Milestone

Comments

@goclixy-core
Copy link

goclixy-core commented Oct 24, 2016

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?

<input ion-autocomplete type="text" readonly="readonly" class="ion-autocomplete search" autocomplete="off" />

@goclixy-core
Copy link
Author

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?

@guylabs guylabs added this to the Backlog milestone Oct 27, 2016
@guylabs
Copy link
Owner

guylabs commented Oct 27, 2016

Hi @parveensaini5

I see your point but for what do you need to access the search element?

Thanks and regards,

Guy

@goclixy-core
Copy link
Author

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

@guylabs
Copy link
Owner

guylabs commented Nov 1, 2016

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

@goclixy-core
Copy link
Author

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

@guylabs guylabs modified the milestones: 0.4.1, Backlog Feb 23, 2017
@guylabs guylabs self-assigned this Feb 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants