title: Why does ng-if messes up with my javascript while ng-show doesn't?
body: <p>I have an element(a sidebar) where I only want to show it when the user is authenticated. This sidebar has some javascript actions, like expanding/contracting toggler. When I use ng-show, it works fine, but when I use ng-if it just stops working. Does anyone know why it happens? <strong>I don't have problem rendering it. The problem is some jquery scripts don't work while using ng-if.  I know the difference between ng-if and ng-show, where ng-if creates a new DOM, scope and all, while ng-show just hides the element with CSS.</strong></p>
  
  <pre><code>&lt;div ng-if="sidebar &amp;&amp; signedUser" ng-cloak&gt;
  
      (some components here...)
  
      &lt;ul class="navbar-nav sidenav-toggler"&gt;
        &lt;li class="nav-item"&gt;
          &lt;a class="nav-link text-center" id="sidenavToggler"&gt;
            &lt;i class="fa fa-fw fa-angle-left"&gt;&lt;/i&gt;
          &lt;/a&gt;
        &lt;/li&gt;
      &lt;/ul&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/nRSJU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/nRSJU.png" alt="Expanded sidebar (using ng-if the toggler doesn&#39;t work)"></a></p>
  
  <p><a href="https://i.stack.imgur.com/UEjIq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UEjIq.png" alt="Using ng-show I can contract it"></a></p>