Reputation: 2274
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?
Upvotes: 2
Views: 314
Reputation: 2641
Try in this way:
<progress-bar [progress]="global['getProgress_'+pageID]()"></progress-bar>
Upvotes: 1