View angular-custom-pipes-10.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Pipe, PipeTransform } from '@angular/core'; | |
@Pipe({ | |
name: 'myCustomPipe' | |
}) | |
export class MyCustomPipe implements PipeTransform { | |
transform(value:number, param1?:any, param2?:any):number { | |
return (value * param1) / param2; // returns 50 | |
} | |
} |
View angular-custom-pipes-9.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>{{ 100 | myCustomPipe: 5: 10 }}</h1> // Output: 50 | |
View angular-custom-pipes-8.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Pipe, PipeTransform } from '@angular/core'; | |
@Pipe({ | |
name: 'myCustomPipe' | |
}) | |
export class MyCustomPipe implements PipeTransform { | |
transform(value: any, args?: any): any { | |
return value; | |
} | |
} |
View angular-custom-pipes-7.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>{{ 'Hello world' | myCustomPipe }}</h1> // Output is empty | |
View angular-custom-pipes-6.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Pipe, PipeTransform } from '@angular/core'; | |
@Pipe({ | |
name: 'myCustomPipe' | |
}) | |
export class MyCustomPipe implements PipeTransform { | |
transform(value: any, args?: any): any { | |
return null; | |
} | |
} |
View angular-custom-pipes-5.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>{{ 500 | currency : 'GBP' }}</h1> // Output: £500 | |
View angular-custom-pipes-4.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>{{ 500 | currency }}</h1> // Output: $500 | |
View angular-custom-pipes-3.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>{{ 'Hello world' | titlecase }}</h1> // Output: Hello World | |
View angular-custom-pipes-2.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>{{ 'Hello world' | lowercase }}</h1> // Output: hello world | |
View angular-custom-pipes-1.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>{{ 'Hello world' | uppercase }}</h1> // Output: HELLO WORLD | |
NewerOlder