ngx-slider icon indicating copy to clipboard operation
ngx-slider copied to clipboard

Calling async function inside Options translate

Open Suroor-Ahmmad opened this issue 4 years ago • 0 comments

Hi, I'm using currency converter in my application (using Forex rate). I want to display exchange rate in the slider. Since translate is not an async function what's the workaround? I tried below code which will of course return Promise object

this.options = {
    floor: 0,
    ceil: 1000,
    step: 50,
    animate: false,
    translate: (value: number): any => {
        return (async (): Promise<number> => {
             return await Promise.resolve(this.currencyService.getExchangeRate({ source: 'USD', target:'AED, amount: value }));
        })();
    }
};

Suroor-Ahmmad avatar Mar 15 '20 08:03 Suroor-Ahmmad