Skip to content

Instantly share code, notes, and snippets.

😃
Writing Code and Having Fun :)

Abuzer Asif AbuzerAsif

Block or report user

Report or block AbuzerAsif

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View angular-custom-pipes-10.ts
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
<h1>{{ 100 | myCustomPipe: 5: 10 }}</h1> // Output: 50
View angular-custom-pipes-8.ts
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
<h1>{{ 'Hello world' | myCustomPipe }}</h1> // Output is empty
View angular-custom-pipes-6.ts
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
<h1>{{ 500 | currency : 'GBP' }}</h1> // Output: £500
@AbuzerAsif
AbuzerAsif / angular-custom-pipes-4.html
Last active Apr 3, 2019
Angular Custom Pipes and How it works
View angular-custom-pipes-4.html
<h1>{{ 500 | currency }}</h1> // Output: $500
@AbuzerAsif
AbuzerAsif / angular-custom-pipes-3.html
Last active Apr 3, 2019
Angular Custom Pipes and How it works
View angular-custom-pipes-3.html
<h1>{{ 'Hello world' | titlecase }}</h1> // Output: Hello World
@AbuzerAsif
AbuzerAsif / angular-custom-pipes-2.html
Last active Apr 3, 2019
Angular Custom Pipes and How it works
View angular-custom-pipes-2.html
<h1>{{ 'Hello world' | lowercase }}</h1> // Output: hello world
@AbuzerAsif
AbuzerAsif / angular-custom-pipes-1.html
Last active Apr 3, 2019
Angular Custom Pipes and How it works
View angular-custom-pipes-1.html
<h1>{{ 'Hello world' | uppercase }}</h1> // Output: HELLO WORLD
You can’t perform that action at this time.