I have a situation where I am using two recursive directives inside ui-bootstrap tabs. In order to optimize performance, I want the directive to only load when its corresponding tab is active. To achieve this, I am using ng-if on the directive like this:
<dave ng-if="activeTab === 0"></dave>
...
<bob ng-if="activeTab === 1"></bob>
The issue arises when switching between Tab 0 and Tab 1 - the directive content does not refresh properly. Even though it should show "dave" when on Tab 0 and "bob" when on Tab 1, sometimes it shows the incorrect content. I attempted placing the directives within a div and applying ng-if on that, but the problem persists.
If you'd like to see the problem in action, check out this Codepen link.