Skip to content

Instantly share code, notes, and snippets.

@pratikthecook
Last active May 24, 2017 04:43
Decimal Pipe
import {Component} from '@angular/core';
@Component({
selector: 'decimal-pipe',
template: `
<h2>Decimal Pipe Example</h2>
<p>pi (no formatting): {{pi}}</p>
<p>pi (.5-5): {{pi | number:'.5-5'}}</p>
<p>pi (2.10-10): {{pi | number:'2.10-10'}}</p>
<p>pi (.3-3): {{pi | number:'.3-3'}}</p>
`
})
export class DecimalPipe {
pi: number = 3.1415927;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment