2

On every page of my app, I have a download button to download a certain, page specific file. Every page uses the same template.

To make sure I don't lose the progress of a download, I've made a global variable which holds the progress of the download:

this.global['setProgress_' + this.pageID](Math.round((progressEvent.loaded / progressEvent.total) * 100));

To show the progress on each page, I could use:

<progress-bar [progress]="global.getProgress_page1()"></progress-bar>

This works fine, but of course with this code you would see the same progress on every page, since I alway get the progress of page1.

How could I make this dynamic? I've tried:

<progress-bar [progress]="global.getProgress_{{pageID}}()"></progress-bar>

But this makes the app crash. What's the right syntax to do this?

1 Answer 1

1

Try in this way:

<progress-bar [progress]="global['getProgress_'+pageID]()"></progress-bar>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.