2

I am new in angular 2. In angular 2 project generated by angular-cli, i saw the following code in index.html file but it seems that the word loading is not shown.

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

My question is:
1) What is the purpose of having the Loading text in between <app-root>?
2) When will the word loading be shown?
3) How can i force the loading text to be shown?

2 Answers 2

3

NOTE: Not tried with CLI but this should work.

1 & 2) Purpose of Loding.. text is: if, for some reason, it takes some time(due to slow network or some other reason) to load or initiate or bootstrap the app, it will show Loading... text

Do you have main.ts file?
or somewhere you have platformBrowserDynamic().bootstrapModule(AppModule) line where you bootstrap mainmodule/appmodule. Just wrap it around setInterval() then you'll be able to see loading... text

3) Forcefully showing it

setInterval(()=>{
  platformBrowserDynamic().bootstrapModule(AppModule);  
},10000)

DEMO (with core angular2 app -NOT Angular-CLI) : in there look for main.ts file.

https://plnkr.co/edit/oiT4L79c21EP2MQXq0oM?p=preview

Sign up to request clarification or add additional context in comments.

Comments

0

is unknown tag to browser unless it is compiled.. so it will show the loading text untill the root compenent is compiled, once it is compiled it will replace the inner content with it's compiled content.

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.