First create a Pipe.

    import { Pipe, PipeTransform } from '@angular/core';
    import { DomSanitizer, SafeHtml } from '@angular/platform-browser';

    @Pipe({
    name: 'sanitizer',
    })

    export class SanitizerUrlPipe implements PipeTransform {
    constructor(private sanitizer: DomSanitizer) {}

    transform(value: string, args: any = 'SafeURL'): SafeUrl | SafeHtml {
        if (args == 'SafeHtml') {
            return this.sanitizer.bypassSecurityTrustHtml(value);
        } 
      }
    }

Then, use the pipe in your HTML template like this.

    <div [innerHtml]="data | sanitizer : 'SafeHtml'"></div>