https://api.exchangeratesapi.io/latest,这是我的API。在我的.ts中,我正在
this.currencyProvider.GetCurrencyData().subscribe((data) =>{
this.currency=data.rates
});
,这是否意味着在我的HTML中,我只需要做类似的事情 {{货币:美元}} 或者是别的什么?完成此操作后,甚至在页面上什么也没有显示
答案 0 :(得分:0)
我为您找到了解决方案:
在组件中:
public currency;
this.currencyProvider.GetCurrencyData().subscribe((data:any) =>{
this.currency=data.rates;
});
在HTML中:
<div>
{{currency?.USD}}
</div>
工作演示:link