I have an ng-repeat
with a filter. When some items are filtered out by the filter and then they are restored after another filter change there are new DOM elements created for these items. If there was any DOM manipulation on the item it gets lost after item is hidden and restored with filter.
Is there a way to keep the DOM elements, even when item is removed by filter?
I tried using track by
, but it doesn't help.
Here is a fiddle that recreates the problem. Steps to recreate:
- Click the button to apply colors to DOM elements
- Type something in the filter input (for example 'ap') to hide some of the elements
- Remove the filter. The restored elements lost their style.