Pipe helper for local methods
#angular #pipe #custom
β Link: https://medium.com/@shulha.y/stop-executing-function-on-angular-html-template-c0fdd1d13b03
#angular #pipe #custom
β Link: https://medium.com/@shulha.y/stop-executing-function-on-angular-html-template-c0fdd1d13b03
βResponsive utilityβ Pipe: BreakpointObserver
#angular #cdk #pipe #BreakpointObserver
β Link: https://medium.com/@federico.monaldi/angular-write-a-responsive-utility-pipe-breakpointobserve-d9051c60cf9c
#angular #cdk #pipe #BreakpointObserver
β Link: https://medium.com/@federico.monaldi/angular-write-a-responsive-utility-pipe-breakpointobserve-d9051c60cf9c
Sanitization Pipe in Angular
#angular #pipe #DomSanitizer
β Link: https://medium.com/@zeeshankhan8838/best-practices-in-angular-b9e8f88ee1fa
#angular #pipe #DomSanitizer
β Link: https://medium.com/@zeeshankhan8838/best-practices-in-angular-b9e8f88ee1fa
Appβs Performance by Wrapping Functions Inside a Pipe
#angular #pipe
β Link: https://medium.com/ngconf/boost-your-apps-performance-by-wrapping-your-functions-inside-a-pipe-7e889a901d1d
#angular #pipe
β Link: https://medium.com/ngconf/boost-your-apps-performance-by-wrapping-your-functions-inside-a-pipe-7e889a901d1d
π1
π
#angular #pipe #errors
β Article Link: https://max-syniuk.medium.com/handle-angular-form-control-validation-errors-using-pure-pipe-7c3a874ce77
π Code Link:
- Pipe
https://gist.github.com/maksym-syniuk/c2a8bba5144e05e3edce19e81d998706#file-control-error-handler-pipe-ts
- Use case
https://gist.github.com/maksym-syniuk/972aaf537c9bffaf30d43a5ede380046#file-app-component-html
FormControl validation errors using pure pipe#angular #pipe #errors
β Article Link: https://max-syniuk.medium.com/handle-angular-form-control-validation-errors-using-pure-pipe-7c3a874ce77
- Pipe
https://gist.github.com/maksym-syniuk/c2a8bba5144e05e3edce19e81d998706#file-control-error-handler-pipe-ts
- Use case
https://gist.github.com/maksym-syniuk/972aaf537c9bffaf30d43a5ede380046#file-app-component-html
Please open Telegram to view this post
VIEW IN TELEGRAM
π Angular Utilities: call pipe
#angular #pipe
β Article Link: https://medium.com/@mikekucherov92/angular-utilities-call-pipe-23b6ada72b93
#angular #pipe
β Article Link: https://medium.com/@mikekucherov92/angular-utilities-call-pipe-23b6ada72b93
π Angular Pipes: Uppercase First Pipe
#angular #pipe
Usage in an Angular template:
#angular #pipe
This pipe capitalizes the first letter of a string while keeping the rest in lowercase.
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({ name: 'uppercaseFirst' })
export class UppercaseFirstPipe implements PipeTransform {
transform(value: string): string {
if (!value) return value;
return value
.charAt(0)
.toUpperCase() + value.slice(1).toLowerCase();
}
}Usage in an Angular template:
<p>{{ 'hello world' | uppercaseFirst }}</p>
<!-- Output: "Hello world" -->β€1π1π₯1
π Angular Pipes: Reverse String Pipe
#angular #pipe
Usage in an Angular template:
#angular #pipe
This pipe reverses the characters of a string.
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({ name: 'reverseString' })
export class RSPipe implements PipeTransform {
transform(value: string): string {
if (!value) return value;
return value.split('').reverse().join('');
}
}Usage in an Angular template:
<p>{{ 'Angular' | reverseString }}</p>
<!-- Output: "ralugnA" -->π₯1
π Angular Pipes: Phone Number Formatter Pipe
#angular #pipe
Usage in an Angular template:
#angular #pipe
Formats a raw string of numbers into a well-structured phone number format (e.g., (555) 555β5555).
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({ name: 'phoneNumberFormatter' })
export class PNFPipe implements PipeTransform {
transform(value: string): string {
if (!value || value.length !== 10) return value;
return `(${value.slice(0, 3)}) ${value.slice(3, 6)}-${value.slice(6)}`;
}
}Usage in an Angular template:
<p>{{ '1234567890' | phoneNumberFormatter }}</p>
<!-- Output: "(123) 456-7890" -->π₯1
π Angular Pipes: File Size Pipe
#angular #pipe
Usage in an Angular template:
#angular #pipe
Converts a file size in bytes to a more human-readable format, such as KB, MB, or GB.
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({ name: 'fileSize' })
export class FileSizePipe implements PipeTransform {
transform(bytes: number): string {
if (isNaN(bytes) || bytes === 0) return '0 Bytes';
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
const i = Math.floor(
Math.log(bytes) / Math.log(1024)
);
return `${parseFloat((bytes / Math.pow(1024, i)).toFixed(2))} ${sizes[i]}`;
}
}Usage in an Angular template:
<p>{{ 1024 | fileSize }}</p>
<!-- Output: "1 KB" -->π₯2