I'm currently working on some code for an application and I'm trying to set a limit for the messages in the chat.
this.messageLimit = -10;
$scope.messageCount = //stores the number of messages
<button ng-if="messageCount > -main.messageLimit"
ng-click="main.messageLimit=-10+main.messageLimit">Load More</button>
<li class="singleMessage clearfix"
ng-repeat="msg in chat.messages | limitTo:main.messageLimit"
ng-class="::{myMessage: msg.senderName != chat.name}">
<img class="profileImage" alt="::{{chat.name}}" width="40px">
<p ng-bind-html="parseMsg(msg)"></p>
</li>
Despite my efforts, the messages are not being limited and all of them continue to appear. Can anyone provide some guidance?