0

My index.html is:

<body>
<app-root>
 Loading...
</app-root>
...
...

I have a pure css loader and it worked fine when I replace Loading... with my loader, Now I want to implement percentage loading from 0% to 100% but I can do nothing with functions or ts processing in my index.html. What is the best way to that?

Marvin Ericson
  • 239
  • 2
  • 7
  • 20

1 Answers1

0

Percentage loading depends upon your contents. If you know what and how much contents you need to load, you can divide 100 among each content. For example, if you have 5 different contents to load at startup, you can divide each 20% value. You have to then load the content asynchronously and increase a counter by 20 every time one of your content is loaded.

var perCounter = 0;

// load each content
perCounter = perCounter + 20;

How to show a percentage in HTML, is via various option you might choose one. One example is here.

Umesh
  • 2,704
  • 19
  • 21