Currency Pipe with dynamic arg

angular currency pipe example
angular currency pipe no decimal
angular currency pipe negative
angular 7 currency input
angular currency pipe in component
angularjs currency pipe
angular currency pipe euro
angular currency pipe input

this :

<div *ngIf="isMonetary(col)">
  {{ row[col] | currency }}
</div>

works but is with dollar by default.

the docs (https://angular.io/api/common/CurrencyPipe) say the first arg you can pass is the currency in ISO 4217 standard

I HAVE the currency in ISO 4217 standard but it MUST be dynamic. it's not per component, or per table it's per entry in the table.

Angular's currency pipe is refusing to interpret and somehow expects args to be static :

this is read as a string and "getCurrency(row)" written out shows up on my page after the monetary value :

<div *ngIf="isMonetary(col)">
  {{ row[col] | currency:'getCurrency(row)' }}
</div>

this is an HTML syntax error :

<div *ngIf="isMonetary(col)">
  {{ row[col] | currency:'{{row['currency']}}' }}
</div>

so is this :

<div *ngIf="isMonetary(col)">
  {{ row[col] | currency:'{row['currency']}' }}
</div>

so is this :

<div *ngIf="isMonetary(col)">
  {{ row[col] | currency:{row['currency']} }}
</div>

so is this :

<div *ngIf="isMonetary(col)">
  {{ row[col] | currency:'row['currency']' }}
</div>

is there a way out of this? (no I'm not going to put a *ngIf="" for every existing currency).

In each of your try you put the value to interpret into single quot

exemple

{{ row[col] | currency:'getCurrency(row)' }}

Simply remove those quot and angular will interpret them correctly if your method getCurrency() return an ISO 4217 string

{{ row[col] | currency:getCurrency(row)}}

angular - Currency Pipe with dynamic arg, Angular's currency pipe is refusing to interpret and somehow expects args to be static : this is read as a string and "getCurrency(row)" written  Currency Pipe with dynamic arg. 0. Angular Currency pipe in component. Hot Network Questions Writing style in academic English

Try this:

<div *ngIf="isMonetary(col)">
  {{ row[col] | currency:row['currency'] }}
</div>

Angular Currency Pipe & Format Currency In Angular with examples , Angular Currency Pipe is one of the bulit in pipe in Angular used to Argentine peso Currency, {{Value|currency:"ARS":"symbol"}}, $100.00. symbol-narrow: Use the narrow symbol for locales that have two symbols for their currency. For example, the Canadian dollar CAD has the symbol CA$ and the symbol-narrow $. If the locale has no narrow symbol, uses the standard symbol for the locale. String: Use the given string value instead of a code or a symbol. For example,

I figured it out with pure brute force

it's :

{{ row[col] | currency:(row['currency']) }}

Custom Angular Pipes and Dynamic Locale - DailyJS, Then we can't just send the language to our bootstrapping module once and be done with it. The built-in date and number pipes do accept locale as an argument​  Angular Currency Pipe is one of the bulit in pipe in Angular used to format currency value according to given country code,currency,decimal,locale information.

CurrencyPipe, Transforms a number to a currency string, formatted according to locale rules that The following code shows how the pipe transforms numbers into text strings,  The problem is that 1000$ is different from 1000€, it's not a matter of translation, the value is different (right now 1000$ = 915.80 €). The currency pipe should not change the symbol of the currency automatically, it makes no sense. So yes, the position of the currency symbol changes but not the symbol itself, sorry.

Pipes, Getting data could be as simple as creating a local variable or as complex as pipe name with a colon ( : ) and then the parameter value (such as currency:'EUR​' ). argument to the transform method for each parameter passed to the pipe. currency : A pipe keyword that is used with pipe operator. It formats a number into currency format. It formats a number into currency format. currencyCode : This is the currency code such as INR for Indian rupee, USD for US dollar.

Step by Step Custom Pipes in Angular, Angular has many Pipes built-in - but they only take us so far and can be fairly limiting Pipe and PipeTransform; Pipe Transform Value; Pipes with Arguments The file.size variable is passed straight through to our transform  currencyCode is the ISO 4217 currency code, such as USD for the US dollar and EUR for the euro. symbolDisplay is a boolean indicating whether to use the currency symbol or code. true : use symbol (e.g. $ ).