Skip to content

Commit

Permalink
fix(component): TrustedType html
Browse files Browse the repository at this point in the history
  • Loading branch information
kolkov committed Apr 20, 2022
1 parent e6f3226 commit 241e81f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion projects/ngx-dadata/src/lib/ngx-dadata.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ import {DadataConfig, DadataConfigDefault} from './dadata-config';
import {ControlValueAccessor, FormControl, NG_VALIDATORS, NG_VALUE_ACCESSOR} from '@angular/forms';
import {DOCUMENT} from '@angular/common';
import {unwrapHtmlForSink} from 'safevalues';
import {DomSanitizer} from '@angular/platform-browser';
import {createHtml} from 'safevalues/implementation/html_impl';

/*const NGX_DADATA_VALIDATOR = {
provide: NG_VALIDATORS,
Expand Down Expand Up @@ -95,6 +97,7 @@ export class NgxDadataComponent implements OnInit, ControlValueAccessor, OnChang
private dataService: NgxDadataService,
private r: Renderer2,
private elRef: ElementRef,
private domSanitizer: DomSanitizer,
@Inject(DOCUMENT) private document: Document,
) {
}
Expand Down Expand Up @@ -213,7 +216,8 @@ export class NgxDadataComponent implements OnInit, ControlValueAccessor, OnChang
} else {
this.v = '';
}
this.r.setProperty(this.inputValue.nativeElement, 'innerHTML', unwrapHtmlForSink(this.v));

this.r.setProperty(this.inputValue.nativeElement, 'innerHTML', unwrapHtmlForSink(createHtml(this.v)));
}

/**
Expand Down

0 comments on commit 241e81f

Please sign in to comment.