Commit 0ba55e7e authored by dev0tion's avatar dev0tion

Adjust coin notation pipe and add it to history component

parent 48998d5c
...@@ -5,10 +5,24 @@ import { Pipe, PipeTransform } from '@angular/core'; ...@@ -5,10 +5,24 @@ import { Pipe, PipeTransform } from '@angular/core';
}) })
export class CoinNotationPipe implements PipeTransform { export class CoinNotationPipe implements PipeTransform {
private coinUnit = "BTC";
private coinNotation: number;
transform(value: any): any { transform(value: any): any {
if (!value) return value; if (!value) return value;
let coinNotation = Number(value).toFixed(8); this.coinNotation = value;
return coinNotation;
switch (this.coinUnit) {
case "BTC":
this.coinNotation = Number(value.toFixed(8));
return this.coinNotation = this.coinNotation / 100000000;
case "mBTC":
this.coinNotation = Number(value.toFixed(8));
return this.coinNotation = this.coinNotation / 100000;
case "uBTC":
this.coinNotation = Number(value.toFixed(8));
return this.coinNotation = this.coinNotation / 100;
}
} }
} }
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
<!--<td *ngIf="{{ transaction.amount }} < 0; else received">SENT</td> <!--<td *ngIf="{{ transaction.amount }} < 0; else received">SENT</td>
<td #received>RECEIVED</td>--> <td #received>RECEIVED</td>-->
<td>{{ transaction.timestamp }}</td> <td>{{ transaction.timestamp }}</td>
<td>{{ transaction.amount }}</td> <td>{{ transaction.amount | coinNotation | coinAbbreviation }}</td>
<td>{{ transaction.confirmed }}</td> <td>{{ transaction.confirmed }}</td>
<td>{{ transaction.txId }}</td> <td>{{ transaction.txId }}</td>
</tr> </tr>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment