Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.1.5/angular-sanitize.js"></script>  
  
  
<meta charset=utf-8 />
<title>ng-bind-html</title>
</head>
<body>
  <div ng-app="myApp" ng-controller="MainCtrl">
  <div ng-bind-html="text | elleipsis:2"></div>
  <div ng-bind-html="text | elleipsis:3"></div>
  <div ng-bind-html="text | elleipsis:4"></div>
</div>
</body>
</html>
 
var app = angular.module('myApp', ['ngSanitize']);
app.controller('MainCtrl', function ($scope) {
    $scope.text = "Test text.";
});
app.filter('elleipsis', function () {
    return function (text, length) {
        if (text.length > length) {
            return text.substr(0, length) + "<a href='#'>...</a>";
        }
        return text;
    };
});
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
annaismepro
0viewers