Posts

Showing posts with the label angular9

Creating Custom Pipes in Angular

Custom Age Pipe with source code implemetation==>   Create age pipe in pipes fder by following command in command terminal ng g p pipes/age age.component.ts => DateOfBirth =   new   Date ( '01/07/1990'  ); age.pipe.ts => import  {  Pipe ,  PipeTransform  }  from   '@angular/core' ; @ Pipe ({   name:  'age' }) export   class   AgePipe   implements  PipeTransform {    transform (value :   any ) :   any  {      console . log ( "print age pipe = "   +   value );      let   currentDate :any   =   new   Date (). getFullYear ();  // 2019      let   birthYear :any   =   new   Date ( value ). getFullYear ();      let   ageofMan :any   =    currentDate   - ...