angular-dom-sanitizer

How to use DomSanitizer inside a function

丶灬走出姿态 提交于 2021-01-28 10:36:48
问题 Hi I´m triyin to build a function to be reusable, and sanitize some content, but I don´t know hoe to call DomSanitizer it allways give me the error that is and abstract class. Here is my function: export function PostFormat(post){ let sanitizer: DomSanitizer; // TODO! post['title'] = sanitizer.bypassSecurityTrustHtml(post['title']['rendered']); post['author'] = post['_embedded']['author'][0]; post['content'] = sanitizer.bypassSecurityTrustHtml(post['content']['rendered']); post['excerpt'] =

How to use DomSanitizer inside a function

人走茶凉 提交于 2021-01-28 10:30:26
问题 Hi I´m triyin to build a function to be reusable, and sanitize some content, but I don´t know hoe to call DomSanitizer it allways give me the error that is and abstract class. Here is my function: export function PostFormat(post){ let sanitizer: DomSanitizer; // TODO! post['title'] = sanitizer.bypassSecurityTrustHtml(post['title']['rendered']); post['author'] = post['_embedded']['author'][0]; post['content'] = sanitizer.bypassSecurityTrustHtml(post['content']['rendered']); post['excerpt'] =

How to use DomSanitizer inside a function

北战南征 提交于 2021-01-28 10:23:40
问题 Hi I´m triyin to build a function to be reusable, and sanitize some content, but I don´t know hoe to call DomSanitizer it allways give me the error that is and abstract class. Here is my function: export function PostFormat(post){ let sanitizer: DomSanitizer; // TODO! post['title'] = sanitizer.bypassSecurityTrustHtml(post['title']['rendered']); post['author'] = post['_embedded']['author'][0]; post['content'] = sanitizer.bypassSecurityTrustHtml(post['content']['rendered']); post['excerpt'] =

Best way to pass angular routerLink URL's in an HTML string

China☆狼群 提交于 2020-01-25 00:14:10
问题 I have a notification service in my angular app, typically you call it like this.notificationsService.showError('My Title', 'My Message...'); I'd like to have the ability to to pass app links in the messages as well, and I know I need to allow SafeHtml input, like this: this.notificationsService.showError( 'Error!', this.domSanitizer.bypassSecurityTrustHtml( `Something has gone wrong, but you can go to <a routerLink="'/home/accounts-list'">home page</a> to start over.` ) ); Over in my service

Angular: Prevent DomSanizer from updating on DOM Events

谁都会走 提交于 2020-01-16 16:54:10
问题 I'm facing an issue with DomSanitizer . I've created a StackBlitz that replicate this issue. Every time the button is clicked, the iframe A is reloaded. The button does absolutely nothing - so it is not related to the iframe. iframe A has a dynamic reference to its source. To make this work I use the DomSanitizer . iframe B has a static reference and no reload here - whats I expected. Just to show it is related to the sanitizer. So I need to have an iframe in my application and its content

Angular: Prevent DomSanizer from updating on DOM Events

蓝咒 提交于 2020-01-16 16:51:09
问题 I'm facing an issue with DomSanitizer . I've created a StackBlitz that replicate this issue. Every time the button is clicked, the iframe A is reloaded. The button does absolutely nothing - so it is not related to the iframe. iframe A has a dynamic reference to its source. To make this work I use the DomSanitizer . iframe B has a static reference and no reload here - whats I expected. Just to show it is related to the sanitizer. So I need to have an iframe in my application and its content

ngFor youtube links with Domsanitizer in Angular2

北慕城南 提交于 2020-01-15 03:16:09
问题 I have youtube links in my mock memory database and I want to *ngFor these videos from youtube. let videos: any[] =[ {videoURL: "ZOd5LI4-PcM"}, {videoURL: "d6xQTf8M51A"}, {videoURL :"BIfvIdEJb0U"} ]; like this. I used service to connect my component with the server and now in the html, I have let v of videos. And within the iframe tages.. I did <iframe src=v.videoURL></iframe> But since it's external source, they are telling me to use Domsanitzer but I am stuck at this part. I don't know how

Angular2 innerHTML removes property, help needed to use DomSanitizer

大憨熊 提交于 2019-12-10 15:35:41
问题 I simply need to inject HTML in a div with id "main-wrapper" , so in my component.ts i am using this code import { Component, OnInit, ElementRef,Renderer2,Inject } from '@angular/core'; import { Pipe } from '@angular/core'; import { DomSanitizer, SafeHtml, SafeStyle, SafeScript, SafeUrl, SafeResourceUrl } from '@angular/platform-browser'; @Component({ selector: 'app-editsection', templateUrl: './editsection.component.html', styleUrls: ['./editsection.component.css'] }) export class

angular 2 missing domsanitizer when try to start

时间秒杀一切 提交于 2019-12-05 23:14:48
问题 im running angular2 rc 5 all doing fine until im restart my pc and doing npm start again, before restart pc everything working fine when im try to start my project again there is an error saying that , node_modules/@angular/platform-browser/index has no exported member 'DomSanitizer' im already try to reinstall the package and copy paste the @angular file from another quickstart that working but still fail with the same error i guess its something wrong with my @angular/platform-browser but i