Using angular 4,
{{31.94 | number:'1.0-0'}} 
Output: 32
Any idea, how to block the round off. Expecting the result is 31
You need to create your custom pipe as DecimalPipe doesn't provide any floor feature. Plus you can add your decimal pipe in it. Your Custom Pipe:
@Pipe({name: 'floor'})
export class FloorPipe implements PipeTransform {
    /**
     *
     * @param value
     * @returns {number}
     */
    transform(value: number): number {
        return Math.floor(value);
    }
}
Use in template as:
  <span>{{ yournumber | floor | your_decimal_pipe }}</span>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With