You can check the module import here
.
bytes
Returns the bytes to an human-readable format.
File
Copy import { NgBytesPipeModule } from 'angular-pipes' ;
Usage
Copy {{ 150 | bytes }}
<!-- 150 B -->
{{ 1024 | bytes }}
<!-- 1 KB -->
{{ 1048576 | bytes }}
<!-- 1 MB -->
{{ 1024 | bytes: 0 : 'KB' }}
<!-- 1 MB -->
{{ 1073741824 | bytes }}
<!-- 1 GB -->
{{ 1099511627776 | bytes }}
<!-- 1 TB -->
{{ 1073741824 | bytes : 0 : 'B' : 'MB' }}
<!-- 1024 MB -->
Todo
Be able to change the input unit.
ceil
Ceils a number with a given precision. Take a look at the official documentation on ceil.
File
Copy import { NgCeilPipeModule } from 'angular-pipes' ;
Usage
Copy {{ 3.4 | ceil }}
<!-- 4 -->
{{ 1.5 | ceil: 1 }}
<!-- 1.5 -->
{{ 1.5444 | ceil: 2 }}
<!-- 1.55 -->
floor
Floor a number with a given precision. Take a look at the official documentation on floor.
File
Copy import { NgFloorPipeModule } from 'angular-pipes' ;
Usage
Copy {{ 3.4 | floor }}
<!-- 3 -->
{{ 1.5 | floor: 1 }}
<!-- 1.5 -->
{{ 1.5444 | floor: 2 }}
<!-- 1.54 -->
round
Rounds a number with a given precision. Take a look at the official documentation on round.
File
Copy import { NgRoundPipeModule } from 'angular-pipes' ;
Usage
Copy {{ 3.4 | round }}
<!-- 3 -->
{{ 3.5 | round }}
<!-- 4 -->
{{ 1.5 | round: 1 }}
<!-- 1.5 -->
{{ 1.5444 | round: 2 }}
<!-- 1.54 -->
{{ 1.345 | round: 2 }}
<!-- 1.35 -->
degrees
Converts radians to degrees.
File
Copy import { NgDegreesPipeModule } from 'angular-pipes' ;
Usage
Copy this .value = Math . PI ;
Copy {{ value | degrees }}
<!-- 180 -->
radians
Converts degrees to radians
File
Copy import { NgRadiansPipeModule } from 'angular-pipes' ;
Usage
Copy {{ 180 | radians }}
<!-- PI -->
random
Returns a random number between a minimum (default: 0) and a maximum (default: 1). The input is ignored. If only one argument is given, it will be the maximum.
File
Copy import { NgRandomPipeModule } from 'angular-pipes' ;
Usage
Copy {{ {} | random: 0: 1 }}
<!-- Random number between 0 and 1 -->
{{ {} | random: 0: 10 }}
<!-- Random number between 0 and 10 -->
{{ {} | random: 10 }}
<!-- Random number between 0 and 10 -->
sqrt
Returns the square root of a number.
File
Copy import { NgSqrtPipeModule } from 'angular-pipes' ;
Usage
Copy {{ 81 | sqrt }}
<!-- 9 -->
pow
Returns the power of a number.
File
Copy import { NgPowPipeModule } from 'angular-pipes' ;
Usage
Copy {{ 2 | pow }}
<!-- 4 -->
{{ 2 | pow: 3 }}
<!-- 8 -->
abs
Returns the absolute of a number.
File
Copy import { NgAbsPipeModule } from 'angular-pipes' ;
Usage
Copy {{ -2 | abs }}
<!-- 2 -->
ordinal
Returns the number with a suffix indicating the ordinal.
File
Copy import { NgOrdinalPipeModule } from 'angular-pipes' ;
Usage
Copy {{ 1 | ordinal }}
<!-- 1st -->
{{ 523 | ordinal }}
<!-- 523rd -->
{{ 15 | ordinal }}
<!-- 15th -->