Remove DOM-Element with AngularJS
<p>I'm trying to remove a navbar based on the current location path. </p>

<p>This is what I have so far:</p>

<pre><code>angular.module('myModule')
  .controller('MainController', function ($location, $document) {
    if ($location.path().indexOf('resetpass') &gt; -1) {
      var navbar = angular.element($document.querySelector(".top-navbar"));
      navbar.remove();
    }
  });
</code></pre>

<p>With this approach the console says: </p>

<pre><code>angular.js:14110 TypeError: $document.querySelector is not a function
at new &lt;anonymous&gt; (main.controller.js:6)
at Object.invoke (angular.js:4762)
at $controllerInit (angular.js:10518)
at nodeLinkFn (angular.js:9416)
at compositeLinkFn (angular.js:8757)
at compositeLinkFn (angular.js:8760)
at publicLinkFn (angular.js:8637)
at angular.js:1808
at Scope.$eval (angular.js:17913)
at Scope.$apply (angular.js:18013)
</code></pre>

<p>What am I doing wrong?</p>