Try the following:
<ul id = "postsList" ng-init="limit = 500"> <li ng-repeat="post in Posts" > <p>{{ post.messageBody | limitTo:limit }}</p> <button ng-click = "limit = Number.MAX_SAFE_INTEGER">View</button> </li> </ul>
EDIT
That shit. It will change the limit for all messages.
In the controller, you can add the limit property to Posts . And then:
<ul id = "postsList"> <li ng-repeat="post in Posts" > <p>{{ post.messageBody | limitTo:post.limit }}</p> <button ng-click = "post.limit = post.messageBody.length">View</button> </li> </ul>
source share