简体   繁体   中英

How to add numbers together with IF statement in RACTIVE.js?

I am coding in Ractive for a school asignment, but i have a problem that i cannot solve.

I have the following loop:

{{#tasks:i}}
    {{#if sprintId == sprintURL}}
         {{estimatedTime}}, 
    {{/if}}
{{/tasks}}

This Outputs:

300,60,40,50,30,

What I need to do is add the numbers together to output a single total number.

I would like to just add the values to a variable, but that is not possible in Ractive.

Does anyone have a suggestion? I would really appriciate it.

you have to sum up the values in your model. Keep logic out of your templates.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM