I know there must be a simple solution to this that I can't figure out.
I have an array of objects that contain these two values:
team.seed: number,
team.placement: string
team.placement
will either be a simple string like 7, indicating a team made 7th place. It can also be something like 10T
, meaning they tied for 10th
place.
I'm creating a table that should print out all the differences between the initial seed and the final placement:
<tr *ngFor='let team of team_array'>
<td>{{team.placement - team.seed}}</td>
</tr>
This works fine if placement does not have the trailing T, but prints a NaN
value if it does. How can I handle placement so that I can get a numerical value in each case?
question from:
https://stackoverflow.com/questions/65913724/do-some-basic-arithmetic-between-a-string-and-number-in-html-with-angular 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…