I am working on a feature where posts are displayed using ng-repeat in a div, and users can enter new posts in an input box. The posts are sorted so that the latest one appears at the bottom. After adding a new post, I want to automatically scroll down to see it. Is there a smart way to achieve this with Angular, or do I have to resort to using JavaScript?
<div ng-repeat="post in posts | limitTo:-15">
{{post.uid}} : {{post.text}}
</div>
<form>
<input type="textarea" class="chatbox" placeholder="Start typing..." ng-model="newPost"/>
<button class="chatbutton" type="submit" ng-click="addPost(newPost); newPost = null; setInterval();"><span class="glyphicon glyphicon-send"></span></button>
</form>