2

I ever wandered if with Angular 2, is it possible to prerender data then show the page which contains those data? Let I explain what I want:

  1. First step:

I click on a link, the url change but the current page doesn't show again until the data is fully loaded. (I don't want to show gif loader.) It's like a timeout until data is loaded.

  1. Second step:

When data is loaded, I want to display the page which contains those data.

Is there a way to realize this with Angualr 2?

Could somebody give me a link that can explain me this concept?

N.B: I found this: What is best way to load json settings from the server? but I don't really understand how to add this into my code.

This too: https://angular.io/docs/ts/latest/api/core/index/APP_INITIALIZER-let.html but there's no example or more explaination into the official website.

Update

The picture above will show what I want:

enter image description here

Thanx in advanced.

Radonirina Maminiaina
  • 6,958
  • 4
  • 33
  • 60
  • It would be helpful if you could explain what part you don't understand. Here are another examples http://stackoverflow.com/questions/37611549/how-to-pass-parameters-rendered-from-backend-to-angular2-bootstrap-method, http://stackoverflow.com/questions/39033835/angularjs2-preload-server-configuration-before-the-application-starts/39033958#39033958 – Günter Zöchbauer Mar 14 '17 at 08:25
  • @GünterZöchbauer, I will draw something and update my question – Radonirina Maminiaina Mar 14 '17 at 08:35
  • @GünterZöchbauer I add a little scene with this updated question. If you can help me! Thanx! – Radonirina Maminiaina Mar 14 '17 at 08:50
  • You can just use `
    ` to hide the view until the data has arrived and Angular has rendered the view. There might be more to when exactly to set `isDataArrived` to true depending on how exactly you fetch and render the data.
    – Günter Zöchbauer Mar 14 '17 at 08:54
  • It may work, but you know, if the current page has many text, and click on link, I don't want to navigate to the page corresponding with the clicked link until his data is loaded. Because if I use `
    `, it will be show the page corresponding to the clicked link but hide the content, until `isDataArrived` is true. And the page from where i click the link will be immedialty replaced by the content of clicked link. Another way?
    – Radonirina Maminiaina Mar 14 '17 at 09:01
  • Sorry, but I don't understand what you want. – Günter Zöchbauer Mar 14 '17 at 09:02
  • I made an application with angular 2, http://preprod.thedoorman.immo:3000/le-concept-the-door-man.html And if you click on **Location** link, it just change the url and still stay on the link I gave, but If the data into **Location** link is loaded, at that I will display the content of **Location** link. I change **club** link with **location** because club link is static page. May it help you to understant what I want! Thanx @GünterZöchbauer – Radonirina Maminiaina Mar 14 '17 at 09:05

0 Answers0