title: Is it possible to include and emit an event in the string that is sanitized using DomSanitizer pipe in Angular?
body: <p>I tried to pass an click event to a button that is rendered using DomSanitizer.
  But the bounded method is not getting called when the button is clicked.</p>
  <p><strong>component.ts</strong></p>
  <pre class="lang-js prettyprint-override"><code>    export class MyComponent {
         htmlElement = '&lt;button class=&quot;btn btn-primary&quot; (click)=&quot;onClick()&quot;&gt;Add&lt;/button&gt;';
      
      onClick() {
          console.log('submitted');
        }
      }
  </code></pre>
  <p><strong>component.html</strong></p>
  <pre class="lang-html prettyprint-override"><code>    &lt;div [innerHtml]=&quot;htmlElement | sanitizer&quot;&gt;&lt;/div&gt;
  </code></pre>
  <p><strong>pipe.ts</strong></p>
  <pre class="lang-js prettyprint-override"><code>    import { Pipe, PipeTransform } from '@angular/core';
      import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
      
      @Pipe({
        name: 'sanitizer'
      })
      export class SanitizerPipe implements PipeTransform {
        constructor(private _sanitizer: DomSanitizer) {}
          transform(v: string): SafeHtml {
            return this._sanitizer.bypassSecurityTrustHtml(v);
          }
      }
  </code></pre>
  <p>button is displayed properly with style. But click event is not getting triggered.</p>
  <p>Is there any fix or alternative solution for this?</p>