Answers for "pipe example in angular"

0

command to create custom pipe in angular 6

ng generate pipe personName
Posted by: Guest on June-12-2020
0

applying datepipe on interepolating date in html from typescipt

tooltip="{{recentDate | date: 'medium'}}" // Using interpolation
Posted by: Guest on August-17-2020
1

angular pipes

//component.ts file:

import {Pipe, PipeTransform} from '@angular/core';  
@Pipe ({  
  name : 'sqrt'  
})  
export class SqrtPipe implements PipeTransform {  
  transform(val : number) : number {  
    return Math.sqrt(val);  
  }  
}  

//import SqrtPipe inside your module.ts ,
import { SqrtPipe } from './app.sqrt';  
declarations: [  
      SqrtPipe,  
],  
  
//then you can use this pipe in component.html file.  
// <h2>Square root of 625 is: {{625 | sqrt}}</h2>
Posted by: Guest on February-13-2021

Code answers related to "pipe example in angular"

Browse Popular Code Answers by Language