Unable to set root page


#1

Hi there, I’m working on an app and I don’t know what I messed up, now when I set root page to myacc page it doesn’t work, but previously it was working fine. Basically what I’m trying to do is restricting the app from going back to the login page through physical back button of the device by setting root page to myacc page other than homepage after the user logs in.
Below is the screenshot.


#2

Hi,

I had the same problem a week ago.
I solved it on the following way:

Need jQuery for this fix
npm install jquery --save

Install (typings and) the typings file

npm install -g typings
typings install dt~jquery --global --save

At top of your app.component.ts
import * as $ from 'jquery'

Now you need to create a boolean, You will get an true/false so you can decide where you want to send the user to.

ionViewDidLoad()
{
        var self = this;
        this.iTimeout = setTimeout(function() {
            self.returnToPage();
        }, 2500);
}
returnToPage()
    {
        
         if(this.bPageComponent)
         {
             this.navCtrl.setRoot(PAGE);
         }
         else
         {
             this.navCtrl.setRoot(PAGE);
         }
     
    }

Hope this example will help you further.
I used jQuery for the timeout function, Tried it with the angular timeout but doesn’t work for me.


#3

okay in that case let me try that. But how come the problem arises suddenly! It was working fine a week ago.