Skip to content

Instantly share code, notes, and snippets.

@Qarun-Qadir-Bissoondial
Created March 29, 2020 23:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Qarun-Qadir-Bissoondial/f1cbaaa5397a3a4f0887fb1c30976546 to your computer and use it in GitHub Desktop.
Save Qarun-Qadir-Bissoondial/f1cbaaa5397a3a4f0887fb1c30976546 to your computer and use it in GitHub Desktop.
Pipes Demo - Decimal Pipe
import { Component } from '@angular/core';
@Component({
selector: 'app-decimal-pipe',
template: `
<h2>Number-based Pipes!</h2>
<p>This is our small number: {{smallNumber}}</p>
<p>Decimal Pipe: {{smallNumber | number}} (This is 3 decimal places by default)</p>
<p>Decimal Pipe at 4 decimal places: {{smallNumber | number:'1.4'}}</p>
`,
styleUrls: []
})
export class DecimalPipeComponent {
smallNumber: number = 1/7;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment