title: ScrollTo function in AngularJS
body: <p>I'm trying to get a quick nav to work correctly. It's floating on the side. When they click on  a link, it takes them to that ID on the page. I'm following this <a href="http://blog.teamtreehouse.com/smooth-scrolling-in-jquery-quick-tip" rel="noreferrer">guide from Treehouse</a>.
  This is what I have for the scrolling:</p>
  
  <pre><code>$("#quickNav a").click(function(){
      var quickNavId = $(this).attr("href");
      $("html, body").animate({scrollTop: $(location).offset().top}, "slow");
      return false;
  });
  </code></pre>
  
  <p>I initially placed it before the <code>&lt;/body&gt;</code>. But I seem to be running into a race condition where that was firing before the quickNav compiled (it has a <code>ng-hide</code> placed on it, not sure if that's causing it - but it is within the DOM).</p>
  
  <p>If I run that block of code in the console, then the scrolling works as expected. </p>
  
  <p>I figured it'd be more effective to move this into the controller - or more likely within a directive. But I'm not having luck accomplishing that. <strong>How can I get this block of code to work with AngularJS?</strong></p>