Learner
Learner

Reputation: 21405

Angular currency pipe show with given format

I want to apply the currency pipe to get the required output format:

import {Component} from '@angular/core';

@Component({
    selector: 'my-app',
    template: `
            <div id="price">{{price | currency:myCurr: '9.2-2'}}</div>
    `
})
export class AppComponent {
    price = 623.56;
    myCurr = 'EUR';
}

My expected output is €000,000,623.56, but I am getting as 9.2-2312.56

Upvotes: 0

Views: 163

Answers (1)

Anton Marinenko
Anton Marinenko

Reputation: 2982

Looks you forget to add 'symbol' to your template:

@Component({
    selector: 'my-app',
    template: `
            <div id="price">{{price | currency:myCurr:'symbol':'9.2-2'}}</div>
    `
})
export class AppComponent {
    price = 623.56;
    myCurr = 'EUR';
}

Upvotes: 1

Related Questions