When a user submits a form, an overlay appears to thank them. I want the overlay to disappear after 2.5 seconds.
Here is my current code:
import { Component } from '@angular/core';
import { NavController, ViewController } from 'ionic-angular';
import { Storage } from '@ionic/storage';
@Component({
selector: 'finish-page',
templateUrl: 'finish.html'
})
export class FinishPage {
constructor(
public navCtrl: NavController,
public viewCtrl: ViewController
)
{}
ionViewWillEnter()
{
setTimeout(() => {
this.navCtrl.popToRoot();
}, 2500);
}
}
However, the page does not return to the root page and stays on indefinitely.
EDIT: The timeout seems to be working now, but I am encountering this error:
Cannot read property 'popToRoot' of undefined