title: unbind an angular element
body: <p>I have the following code inside of a directive and I want to make sure it gets cleaned up when the scope is destroyed. I've looked online as well as the code and I was wondering how do I unbind an element.</p>
  
  <pre><code>var window = angular.element($window);
  window.bind("resize", function(e){
      abc();
  });
  </code></pre>
  
  <p><strong>Solution:</strong></p>
  
  <pre><code>var abc = function() {};
  
  var window = angular.element($window);
  window.bind('resize', abc);
  
  scope.$on('$destroy', function(e) {
      window.unbind('resize', abc);
  });
  </code></pre>