Monday, February 22, 2016

Auto trim row as per width in HTML

Here is the CSS for the same :

.trimLine
{  
 white-space: nowrap; text-overflow:ellipsis; overflow: hidden; max-height:27px; padding:0px; margin:0px;
}

Show trusted HTML in AngularJS

angular.module('myAngApp.filters', []).
filter("sanitize", ['$sce', function($sce) {
  return function(htmlCode){
    return $sce.trustAsHtml(htmlCode);
  }
}]);

Convert HTML into Plain Text in AngularJS

angular.module('myAngApp.filters', []).
  filter('ConvertToPlainText', function() {
    return function(text) {
      return angular.element(text).text();
    }
  }
);