0

when I refresh page(f5) for a moment footer is just coming to top, then page is loaded. I am using resolver for load data from api. When I route from another component everything works as expected, data is loaded before. How to load data from API before refresh, then load component? Like resolver?

  constructor(private route: ActivatedRoute, private dataService: DataService, private router: Router
              , private modalService: NgbModal) {
            this.completeServer = this.route.snapshot.data['completeServer'];
  }

  ngOnInit(): void {
    handleData();
  }

On screenshot I catched a moment, when page look like I described it above.

enter image description here

R. Richards
  • 24,603
  • 10
  • 64
  • 64
korallo
  • 87
  • 2
  • 8
  • Not exactly a useful thing, rather you should only show the footer when the data from the api has been loaded – vaira Nov 18 '21 at 21:41
  • I am trying to make sure that I follow you correctly. All you need is for the component to load when the data is received? – Winnemucca Nov 18 '21 at 22:12
  • @Winnemucca Data is loading, but after pressing f5 (refreshing website) for a moment, the website look like this. On screenshot I just catched this moment, when website is trimmed. I am looking for solution to this. So I mean, loading component when data is received, should solve the problem. And that's how I solved it when routing between components on website. With resolver. But don't know how to implement this on refreshing – korallo Nov 19 '21 at 08:04
  • I believe handleData() could be called in a parent component. You could pass that data to a child component through an ()Input. With the input you can add an *ngIf statement. It is hard to give an exact answer. I realize you have a resolver, but I can only see so much of your architecture. – Winnemucca Nov 22 '21 at 20:18
  • @Winnemucca Handle data is just formating data received from resolver, and drawing chart. – korallo Nov 28 '21 at 15:12
  • Currently I am just hiding footer on page load. – korallo Nov 28 '21 at 15:35

0 Answers0