Angular currency pipe without value

Discussão em 'Angular' iniciado por user16831793, Janeiro 31, 2025.

  1. user16831793

    user16831793 Guest

    Is it possible to use the currency pipe without actual amount/value?

    Usage with value as in https://angular.io/api/common/CurrencyPipe:

    @Component({
    selector: 'currency-pipe',
    template: `<div>
    <!--output 'CA$0.26'-->
    <p>{{a | currency:'CAD'}}</p>
    </div>`
    })
    export class CurrencyPipeComponent {
    a: number = 0.259;
    b: number = 1.3495;
    }


    Output: CA$0.26

    However, I need to input 'CAD' and output 'CA$'. Is this possible somehow?

    Desired behaviour:

    @Component({
    selector: 'currency-pipe',
    template: `<div>
    <p>{{currency | currency:'CAD'}}</p>
    </div>`
    })


    Desired Output: CA$

    Continue reading...

Compartilhe esta Página