I am building a chat system using AngularJS and Laravel.
I want to have an infinite scroller inside a div container using AngularJS. What I want is a chat box which will show the last 30 chat messages when the user clicks on the username; And when the user scrolls up in the container (not the browser window) then I want to run an AJAX request and fetch the previous 30 records, like we do in the facebook chat application.
Here is my HTML code:
<ul class="chats" ng-repeat="chatData in DataChats">
<li>
<div class="message">
<a> {{chatData.sender_fname }} </a>
<span class="body"> {{chatData.message }} </span>
</div>
</li>
</ul>
and anular js code
$scope.showChat = function(chat_id) {
$http.get(url+'/chat/'+chat_id).success(function(data){
$scope.DataChats= data;
});
}
I have searched the dependency for AngularJS but I only found this for browser like this one Ng infinite scroll. How can I do the container into a Facebook like chat when we scroll up and it shows previous messages?
This is what I want to achieve: