我以前有这段代码:
<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''