title: AngularJS DOM selector
body: <p>I've got a few custom directives that use jQuery for animation effects (angular's built-in ngShow/ngHide and the like are functional, but not pretty). I think I remember reading in the documentation somewhere that angular has its own DOM selector (something like <code>angular.export()</code> or <code>angular.select()</code>) that I should use instead of <code>$(SELECTOR)</code>; however I can't find it now.</p>
  
  <p>I'm doing something like this:</p>
  
  <pre><code>//view
  &lt;div scroll-to="element"&gt; //`element` is set via ng-click
    …
  &lt;/div&gt;
  
  //directive
  link: function(scope, elm, attrs)
  {
  
    scope.$watch(attrs.scrollTo, function scrollToAction(newValue,oldValue)
    {
      if ( newValue !== oldValue )
      {
        elm.animate({
          scrollTop:
            $('#'+newValue).offset().top //replace jquery selector with angular's
            - elm.offset().top
            + elm.scrollTop()
        });
      }
    });
  
  }
  </code></pre>
  
  <p>I'm not really manipulating <code>$('#'+newValue)</code>, just retrieving info about it, so I don't think I'm committing a crime against Angular.</p>