This repository was archived by the owner on May 29, 2019. It is now read-only.
fix(dropdown): support ngIf directive in templates of dropdown menus. #6176
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When specifying a template-url for the dropdown-menu, the use of jQuery's replace has problems with the comments inserted into the DOM by the ngIf directive and results in incomplete removal of the DOM when the dropdown menu is closed. The problem becomes readily apparent when the menu is open and closed multiple times, as the build up of stale DOM elements starts to create an expanding shadow from the dropdown-menu CSS class.
Example code demonstrating the issue:
Using jQuery's html and empty functions, combined with only using the list-item elements in the template specified by template-url allows the use of the ngIf directive without issue.
Working example after making the pull request changes: