0

I'm working with Angular 4 and I have used the CoinMarketCap API. But there's a field that's been giving me a big headache. Any suggestions?

this:

"24h_volume_usd": "72855700.0", 

this is my html:

<tr *ngFor="let coin of coins">
  <td>{{coin.24h_volume_usd | currency:'USD':true:'1.0-2'}}</td>
</tr>

this is error:

 Uncaught Error: Template parse errors:
 Parser Error: Unexpected token '0.24' at column 5 in [{{coin.24h_volume_usd | currency:'USD':true:'1.0-2'}}] 

2 Answers 2

2

Symbols can't start with a number in JS. So you'll need to use the array syntax:

<td>{{coin['24h_volume_usd'] | currency:'USD':true:'1.0-2'}}</td>
Sign up to request clarification or add additional context in comments.

Comments

0

It appears that you can't begin a property with a number. So change 24h_volume_usd to something else such as _24h_volume_usd

I just tried modifying one of my variables to start with a number and also see several syntax errors.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.