Nav.setRoot is not working when i'm trying to go outside a tab


#1

I’ve a function located in my program. If i obtain certain value i redirect the user to a page outside of the tabs.

In a function this works, in another function not. I don’t understand nothing


#2

Provide your .TS file here so we can watch the code


#3

It’s quite long… I’ve a function who check if a variable is setted to true, if not i redirect to the user


#4

Cant help you further with the information you are providing at this moment.
Doesn’t matter, just share it and we can help you.

Paste it in code tag.

Thanks


#5

I have a function inside of a tab who do this

  noconex(){
    this.navCtrl.setRoot(OfflinePage, {texto: 'No connection!'});
  }

I don’t know why but if i do that the Page is pushed inside the tab and not setted as a root… I don’t know why, it’s annoying and i’ve spent all the morning with this


#6

Yeah, I really can’t help you with the information you provide.
I asked for your .TS file, it’s for me just taking a gamble at this moment with throwing possible solutions.


#7

My question is: How can i setRoot another page programatically if i’m in a ts who contains a TAB.
I wanna go to another page, not load or push a page into that tab


#8

Normally is that possible with the code you provided above.
But I cant help you further then this.


#9

I’m trying to do this inside a page in a view of a tab. My intention is navigate to a page and set root inside a page, i’m trying this but doesn’t works

@ViewChild(Nav) nav: Nav;
pages: OfflinePage;
noconex(){
    this.nav.setRoot(this.pages);
  }

ERROR TypeError: Cannot read property 'setRoot' of undefined