Hi,
I was wondering if it was possible to have a modal open after the first launch of an application. I would like to use it as a terms and conditions type of thing. I was not able to find what I was looking for when doing some research.
Thanks!
Hi,
I was wondering if it was possible to have a modal open after the first launch of an application. I would like to use it as a terms and conditions type of thing. I was not able to find what I was looking for when doing some research.
Thanks!
Hi @jeff3597,
In which ionic version you want this?
Preferably In ionic 3 if that is possible
Hi there @jeff3597, have you seen ionic storage? I think it does the trick you’re looking for.
I have tried but I have not been able to implement in correctly. Would you happen to have any sample code?
As @andreven pointed out, this can be done with the storage service: https://ionicframework.com/docs/storage/. It would look like this in your app’s initialization code (untested):
this.storage.get('__modalShown').then((modalShown) => {
if (!modalShown) {
// open modal here
this.storage.set('__modalShown', true);
}
})
would it go in the NgOnInit() function? Or is there a better place to put it?
Use the ionViewDidEnter hook I would say. Not sure if ionViewWillEnter is ok.
See navcontroller docs
Which is not present in app.conponent.ts
Then u need to rely on angular lifecycle hooks that run after conpletion of the view. And they have a different syntax!
I would actually create a function to check that on my app.component.ts