src/misc/filters.js
function trustHtmlAutoFilter($sce, ngeoStringToHtmlReplacements) {
  return function(input) {
    if (input !== undefined && input !== null) {
      if (typeof input === 'string') {
        for (const replacement of ngeoStringToHtmlReplacements) {
          if (input.match(replacement.expression)) {
            input = replacement.template.replace(/\$1/g, input);
            break;
          }
        }
        return $sce.trustAsHtml(`${input}`);
      } else {
        return $sce.trustAsHtml(`${input}`);
      }
    } else {
      return $sce.trustAsHtml('&nbsp;');
    }
  };
}
function trustHtmlAutoFilter($sce, ngeoStringToHtmlReplacements) {
  return function(input) {
    if (input !== undefined && input !== null) {
      if (typeof input === 'string') {
        for (const replacement of ngeoStringToHtmlReplacements) {
          if (input.match(replacement.expression)) {
            input = replacement.template.replace(/\$1/g, input);
            break;
          }
        }
        return $sce.trustAsHtml(`${input}`);
      } else {
        return $sce.trustAsHtml(`${input}`);
      }
    } else {
      return $sce.trustAsHtml('&nbsp;');
    }
  };
}
function trustHtmlAutoFilter ( $sce , ngeoStringToHtmlReplacements ) { return function ( input ) { if ( input !== undefined && input !== null ) { if ( typeof input === 'string' ) { for ( const replacement of ngeoStringToHtmlReplacements ) { if ( input . match ( replacement . expression ) ) { input = replacement . template . replace ( / \$1 / g , input ) ; break ; } } return $sce . trustAsHtml ( ` ${ input } ` ) ; } else { return $sce . trustAsHtml ( ` ${ input } ` ) ; } } else { return $sce . trustAsHtml ( '&nbsp;' ) ; } } ; }
A filter to mark a value as trusted HTML, with the addition of
automatically converting any string that matches the
StringToHtmlReplacements list to HTML.

Usage:

<p ng-bind-html="ctrl.someValue | ngeoTrustHtmlAuto"></p>

If you use it, you don't require the "ngSanitize".
@return {function(?):string} The filter function.
@ngInject
@ngdoc filter
@param {angular.ISCEService} $sce Angular sce service.
@param {!Array.<!StringToHtmlReplacement>}
ngeoStringToHtmlReplacements List of replacements for string to html.
@ngname ngeoTrustHtmlAuto
A filter to mark a value as trusted HTML with the addition of automatically converting any string that matches the StringToHtmlReplacements list to HTML .