docs: more info on currency digits (#24661)

Adds an example of using the `currency` pipe with a currency that has no cents like CLP,
which will format the amount with no digits if `digitsInfo` is not provided:

    <!-- outputs CA$14.00 -->
    {{ 14 | currency:'CAD' }}
    <!-- outputs CLP14 -->
    {{ 14 | currency:'CLP' }}

Amends the docs, adds an example and fix an error with a current example.

PR Close #24661
This commit is contained in:
cexbrayat
2018-06-25 20:05:00 +02:00
committed by Victor Berchet
parent 422de27601
commit ae0fce613f
2 changed files with 7 additions and 1 deletions

View File

@ -18,7 +18,7 @@ registerLocaleData(localeFr);
@Component({
selector: 'currency-pipe',
template: `<div>
<!--output '$0.259'-->
<!--output '$0.26'-->
<p>A: {{a | currency}}</p>
<!--output 'CA$0.26'-->
@ -35,6 +35,9 @@ registerLocaleData(localeFr);
<!--output '0 001,35 CA$'-->
<p>B: {{b | currency:'CAD':'symbol':'4.2-2':'fr'}}</p>
<!--output 'CLP1' because CLP has no cents-->
<p>B: {{b | currency:'CLP'}}</p>
</div>`
})
export class CurrencyPipeComponent {