title: How do I scroll a div in angularjs
body: <p>This is easily done with jQuery:</p>
  
  <pre><code>var msgs = $(".messages ul")
  
  var scroll = false
  
  if( msgs[0].scrollHeight  === (msgs.scrollTop() + msgs.outerHeight() ) )
  {
  
      scroll = true
  
  }
  $scope.messages.push(data)
  if(scroll)
  {
  
      setTimeout(function(){
  
          msgs.scrollTop(msgs[0].scrollHeight) // Allow it to update!
  
      },0)
  
  
  }
  </code></pre>
  
  <p>To give some context, ul is the container of the messages, I iterate over the array in <code>$scope.messages</code> and if the container is scrolled to  the bottom it will stick to the bottom.
  This implementation works for me.</p>
  
  <p>Now, I recently learned how one shouldn't really use jQuery in angular. But I am wondering, how would I achieve something like this in pure AngularJS?</p>