I want to limit the number of characters that are displayed when "ng-repeat" displays JSON data. This app is using AngularJS inside the RoR framework. Currently I have the following code which displays each "item.description" but does not limit the number of characters in the string to a length of 25.
HTML:
<div ng-controller="MyController">
<ul>
<li ng-repeat="item in artists">
{{item.description | limitTo:25}}
</li>
</ul>
</div>
Controller:
var myApp = angular.module('myApp', []);
myApp.controller("MyController", function MyController($scope, $http){
$http.get("/assets/data.json").success(function(data){
$scope.artists = data;
});
I also tried putting the "limitTo:" option inside "ng-repeat" but that limited the amount of "item.description(s)" being displayed, and did not limit the string/content. I followed these instructions for this problem: https://docs.angularjs.org/api/ng/filter/limitTo