1

我曾经有这个代码:

<icon imgSrc="/dist/resources/images/price-tag.png" class="icon pull-xs-left"></icon>
<div id="price-value" class="value">
   {{result?.averagePrice | currency:'USD':true:'1.2-2'}}
</div>

但是我把它做成了一个组件,所以现在使用它就像:

<icon-with-value imgSrc="/dist/resources/images/price-tag.png" [value]='result?.averagePrice' class="icon pull-xs-left"></icon-with-value>

但我需要将其result?.averagePrice显示为货币。如您所见,在我将其作为组件之前就是这样做的。我如何转换这个:[value]='result?.averagePrice'用这样的货币管道传递它:[value]='result?.averagePrice | currency:'USD':true:'1.2-2''

4

0 回答 0