angular-dom-sanitizer

Angular 6 sanitize local drive url

一个人想着一个人 提交于 2019-12-02 04:23:49
问题 I have tried using DomSanitizer methods to sanitize the following type of url with no success C:\path\to\executable Is there any way to sanitize this url to be used as href value? Also I am binding the value with [] notation so I am sure it is not interpolated as string. 回答1: First the url should be C:/path/to/executable not the one C:\path\to\executable According to http://www.ietf.org/rfc/rfc2396.txt backslash characters are not valid characters in URLs Most of the browsers convert the

Angular 2: How can I apply directives to sanitized html/innerhtml

泄露秘密 提交于 2019-11-28 01:34:02
I am working on an application where i am getting responses in html format from a server. I am using the DomSanitizer's bypassSecurityTrustHtml and adding the sanitized html to my component (). My problem is that a few of the elements in the response contains tags to indicate a link can be buildt from the element eg: <div thisIsActuallyaLink linkParam1="foo" linkParam2="bar">clickHere</div> I would like to create a directive that is applied to the innerhtml, but while the html is displayed, it is not compiled with my directive... If anyone is wondering why converting the html is not done

Correct way Provide DomSanitizer to Component with Angular 2 RC6

大兔子大兔子 提交于 2019-11-27 14:56:40
I'm attempting to use DomSanitizer to sanitize a dynamic URL within a Component using I can't seem to figure out what the correct way to specify a Provider for this service is. I'm using Angular 2.0.0-rc.6 Here's my current component: @Component({ templateUrl: './app.component.html', styleUrls: [ './app.component.css' ], providers: [ DomSanitizer ], }) export class AppComponent implements OnInit { public url: SafeResourceUrl; constructor(private sanitizer: DomSanitizer) {} ngOnInit() { let id = 'an-id-goes-here'; let url = `https://www.youtube.com/embed/${id}`; this.videoUrl = this.sanitizer

Angular 2, DomSanitizer, bypassSecurityTrustHtml, SVG

我与影子孤独终老i 提交于 2019-11-27 08:51:05
I've been using DomSanitizer with an SVG in an html string. Previous to the current version of Angular, this worked just fine: this.domSanitizer.bypassSecurityTrustHtml(content); Now I am getting an object back called SafeHtmlImpl {changingThisBreaksApplicationSecurity: "<svg> blah </svg>"} changingThisBreaksApplicationSecurity Is there now a new way to access the output of the DomSanitizer? Should I be receiving it as SafeHTML type or something? What's the point in having bypassSecurityTrustHtml if it still filters html? Any answers on a postcard? Please... micronyks DEMO : https://plnkr.co

Angular 2: How can I apply directives to sanitized html/innerhtml

℡╲_俬逩灬. 提交于 2019-11-26 21:55:07
问题 I am working on an application where i am getting responses in html format from a server. I am using the DomSanitizer's bypassSecurityTrustHtml and adding the sanitized html to my component (). My problem is that a few of the elements in the response contains tags to indicate a link can be buildt from the element eg: <div thisIsActuallyaLink linkParam1="foo" linkParam2="bar">clickHere</div> I would like to create a directive that is applied to the innerhtml, but while the html is displayed,

Correct way Provide DomSanitizer to Component with Angular 2 RC6

冷暖自知 提交于 2019-11-26 16:49:01
问题 I'm attempting to use DomSanitizer to sanitize a dynamic URL within a Component using I can't seem to figure out what the correct way to specify a Provider for this service is. I'm using Angular 2.0.0-rc.6 Here's my current component: @Component({ templateUrl: './app.component.html', styleUrls: [ './app.component.css' ], providers: [ DomSanitizer ], }) export class AppComponent implements OnInit { public url: SafeResourceUrl; constructor(private sanitizer: DomSanitizer) {} ngOnInit() { let id

Angular 2, DomSanitizer, bypassSecurityTrustHtml, SVG

狂风中的少年 提交于 2019-11-26 12:28:42
问题 I\'ve been using DomSanitizer with an SVG in an html string. Previous to the current version of Angular, this worked just fine: this.domSanitizer.bypassSecurityTrustHtml(content); Now I am getting an object back called SafeHtmlImpl {changingThisBreaksApplicationSecurity: \"<svg> blah </svg>\"} changingThisBreaksApplicationSecurity Is there now a new way to access the output of the DomSanitizer? Should I be receiving it as SafeHTML type or something? What\'s the point in having