我的需求是:從后臺(tái)拿來的數(shù)據(jù)中有回車假残,我要換成<br />來識(shí)別換行
import { DomSanitizer } from '@angular/platform-browser';
private sanitizer:DomSanitizer
this.data = this.sanitizer.bypassSecurityTrustHtml(this.selectedItem.data.replace(/\r\n/g, '<br />'));
我的需求是:從后臺(tái)拿來的數(shù)據(jù)中有回車假残,我要換成<br />來識(shí)別換行
import { DomSanitizer } from '@angular/platform-browser';
private sanitizer:DomSanitizer
this.data = this.sanitizer.bypassSecurityTrustHtml(this.selectedItem.data.replace(/\r\n/g, '<br />'));