1// Create a custom pipe
2// First run the command:
3ng g pipe pipes/yourPipeName
4
5// Then import and declare on your module
6import { YourPipeNamePipe } from '../../pipes/your-pipe-name.pipe';
7@NgModule({
8 imports: [
9...
10 ],
11 declarations: [ YourPipeNamePipe ]
12})
13
14// On your-pipe-name.pipe.ts
15@Pipe({
16 name: 'yourPipe'
17})
18...
19transform(value: any, ...args: any[]): any {
20 return "converted test message";
21}
22
23// On your xxx.component.html
24{{"test" | yourPipe}} // prints "converted test message"