I am using a pipe to sanitize trusted resourceurls in an ionic 4 app
safe.pipe.ts
import { Pipe, PipeTransform } from '@angular/core';
import { DomSanitizer } from '@angular/platform-browser';
@Pipe({
name: 'safe'
})
export class SafePipe implements PipeTransform {
constructor(private sanitizer: DomSanitizer) {}
transform(url: string) {
return this.sanitizer.bypassSecurityTrustResourceUrl(url);
}
}
app.module.ts
import { SafePipe } from './services/safe.pipe';<---------
@NgModule({
declarations: [AppComponent, SafePipe],<----------
entryComponents: [],
imports: [
BrowserModule,
IonicModule.forRoot(),
AppRoutingModule,
HttpClientModule
],
providers: [
StatusBar,
SplashScreen,
SafePipe <----------
{ ...
my.page.html
... [data]="urlData | safe" ...
Console error... Error:The pipe 'safe' could not be found!
I followed a tutorial on this and added SafePipe to providers after googling, what is it that am I missing here?? Thanks