Quantcast
Channel: Ionic Forum - Latest topics
Viewing all articles
Browse latest Browse all 70439

Ion-loading right from the start

$
0
0

@dinaflies wrote:

I was wondering if it is possible to start a page with ion-loading element loading right from the start. I’ve tried to create the component at ngOnInit the after an if check and navigateByUrl method provided by router, dismiss the loading element, but not only the ion-loading delay to be shown but also it doesn’t dismiss when navigation is completed. I also tried to make ngOnInit an async function to no avail.

ngOnInit() { 
      this.loadingCtrl.create({
        message: 'Aguarde...',
        translucent: true,
      }).then(el => {
        el.present();
      });

      const userData = new AuthResponseData(
        this.route.snapshot.queryParamMap.get('localId'),
        parseInt(this.route.snapshot.queryParamMap.get('expiresIn')),
        this.route.snapshot.queryParamMap.get('accessToken'),
        this.route.snapshot.queryParamMap.get('refreshToken')
      );
      this.authService.setUserData(userData);
      this.router.navigateByUrl('/usuario/painel').then(
        result => {
          this.loadingCtrl.dismiss();
        }
      );

Any insights on this matter?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 70439

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>