← All pipes
Numbers

roundTo

Numeric decimal-place rounding with signed precision.

Use it in your component

Standalone component
import { Component } from '@angular/core';
import { RoundToPipe } from 'extra-pipe';

@Component({
  standalone: true,
  imports: [RoundToPipe],
  template: `{{ 12.345 | roundTo: 2 }}`,
})
export class ExampleComponent {

}

Template
{{ 12.345 | roundTo: 2 }}

Try it live.

The output below runs the packed library. Edit data, not code.

Use double quotes for text, or a number, array, object or null.
Ordered parameters: precision. Locale is controlled separately.
This pipe has no locale override.
Live template data
readonly value = 12.345;
readonly parameter0 = 2;
{{ value | roundTo: parameter0 }}

Rendered output

12.35