<commit_before>import { DynamicComponent } from './dynamic.component';
import { Injectable, ViewContainerRef, ComponentFactoryResolver, ComponentRef } from '@angular/core';

@Injectable()
export class DynamicBuilderService {

  constructor(private factoryResolver: ComponentFactoryResolver) { }

  createComponent(template: string, viewContainerRef: ViewContainerRef): ComponentRef<DynamicComponent> {
    const factory = this.factoryResolver.resolveComponentFactory(DynamicComponent);
    const componentRef = factory.create(viewContainerRef.parentInjector);
    componentRef.instance.body = template;
    viewContainerRef.insert(componentRef.hostView);
    return componentRef;
  }
}<commit_msg>disable plugin html sanitizing<commit_after>import { DynamicComponent } from './dynamic.component';
import { Injectable, ViewContainerRef, ComponentFactoryResolver, ComponentRef } from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';

@Injectable()
export class DynamicBuilderService {

  constructor(private factoryResolver: ComponentFactoryResolver, private _sanitizer: DomSanitizer) { }

  createComponent(template: string, viewContainerRef: ViewContainerRef): ComponentRef<DynamicComponent> {
    const factory = this.factoryResolver.resolveComponentFactory(DynamicComponent);
    const componentRef = factory.create(viewContainerRef.parentInjector);
    // Trust the html so tags aren't stripped. Risky but adds flexibility for plugins
    componentRef.instance.body = this._sanitizer.bypassSecurityTrustHtml(template);
    viewContainerRef.insert(componentRef.hostView);
    return componentRef;
  }
}
{'fraction_non_alphanumeric': 0.08834355828220859, 'fraction_numerical': 0.0, 'mean_word_length': 6.693396226415095, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4439842', 'n_tokens_mistral': 405, 'n_tokens_neox': 395, 'n_words': 91}