import {ICellRendererAngularComp} from 'ag-grid-angular';
import {Component} from '@angular/core';
import {ICellRendererParams} from 'ag-grid-community';
import * as moment from 'moment';

@Component({
    selector: 'editor-currency-renderer',
    template: `{{ params.value | currency: code }}`,
})
export class CurrencyRendererComponent implements ICellRendererAngularComp {
    public params: ICellRendererParams;
    public code = 'USD';

    agInit(params: ICellRendererParams): void {
        this.params = params;
        // @ts-ignore
        this.code = params.colDef.additionalData.currency;
    }

    refresh(params: any): boolean {
        return false;
    }
}
