I am trying to limit the characters i see on my angular js app. Currently i am using:
If none of the answers above didn't satisfy you, how about the following approach?
var app = angular.module('myTestNgApp', ['ngSanitize']);
app.controller('myMainTestCtrl', function($scope) {
$scope.longText = "This is a very loooooooooooooooooooong text";
})
.filter('textShortenerFilter', function() {
return function(text, length) {
if (text.length > length) {
return text.substr(0, length) + "...";
}
return text;
}
});
Working example:- https://jsfiddle.net/anjanasilva/8xk9eL0t/