vendredi 30 août 2019

how can i call a function inside ember octane template without event?

I have a function called calculatePercentage which take a value and return percentage if i want to call this function inside every li such as

<li></li> 

without any user event how can i do that in ember octane app ?

export const calPrecOfTwoNums = (num: number, min: number, max: number) => {
    let precentageResult = Math.round((((num - min) * 100) / (max - min)));
    if(precentageResult < 0) {
        precentageResult = 0;
    } else if(precentageResult > 100) {
        precentageResult = 100;
    }
    return precentageResult;
}




Aucun commentaire:

Enregistrer un commentaire