How do I navigate from a tab page to another tab page? - mvvm

What is the best way to navigate from a tab page 1 to another tab page 2?
The scenario is that I when I press a button in a tab page, it should navigate to another tab page. I can't set the main tab page's selected tab property because I'm in the tab page 1 viewmodel.
Here is my code, this isn't working but is what I intend to do.
NavigationService.NavigateAsync($"{KnownNavigationParameters.SelectedTab}=TabPage2");
The working code is this, but the problem is that it reloads everything since it navigates to another instance of the MainTabbedPage then selects the TabPage2 tab.
NavigationService.NavigateAsync($"MainTabbedPage?{KnownNavigationParameters.SelectedTab}=TabPage2");

If you want to navigate to tab use the following code, I am using this for navigating from a drawer and it works fine hope it will work for you.
var navParams = new NavigationParameters
{
{ "Title", "Page Title" }
};
NavigationService.NavigateAsync("NavigationPage/{Tab Parent Page}/" + {Tab Page}, navParams );

Related

How to exit app with back button instead of just pop

I am building an app(Learning) and on first use the app it show authentication page with login and signup button if user click any one button and fill the fields it will be navigate to homePage.
Navigation :
Authentication Page=>login=>main page
Now the problem is I don't want users to get back to login page if they press back button on home page. Instead I want to exit the app.
How can I do it?
When you navigate from login to main page use Navigator method .pushReplacement() instead of .push() and that will replace the login page on Navigator stack. Which means that the main page will be the only one on the stack. Pressing the back button or calling method .pop(), in that case, will close the application.

How to push the tabs to deafult page whenever it gets clicked in ionic

I have mainTabs Page in which there are 5 pages
1)Home
)search
3)add
4)notify
5)profile
In search, it is also a tabpage having 2 tabs
1)search video
2)search people
in search video there is a list of videos and when I click on a video it opens a new page playVideo Page.
So at very first when app opens and we click on searchtab then it navigate to search video page and in search video when I click on a video it navigates to play video page.
home->searchtab->searchvideo->playvideo
but whenever I click to another page and reopens the search tab, it still navigate to play video page instead of search video.
home->searchtab->searchvideo->playvideo->notify->searchtab->playvideo
I have tried many things but not find any solution to pop playvideo page at every instance when i click on any other tab
when u leave the playVideo page (onDidLeave) close the tab navigation.
Each tab keeps its navigation history, so when u navigate back to that tab, you will find everything as u left previously.
to avoid this u need to close your navigation on leave
ionViewDidLeave() {
this.navCtrl.popToRoot();
}
Reset a stack history of an Ionic 3 tab

How to restore the root page for a tab?

I'm new to Ionic 3, and what I want to do it's to get the specified scenario:
I go to Tab 1, click on some Item in Tab 1 and go to a view of this item, If I now switch to Tab 2, when I go to Tab 1, the view showed should be the Tab 1 view, not the Item View for a Tab 1 element.
In ionic 1 I previously have used $ionicHistory.clearHistory() but seems now it's not available. I've tried several uses of NavController but seems I am not using it properly or where it means to be used. How can I accomplish this scenario? Also I want to disable the back button in the root Tab 1 view, like, I don't want to see any type of back button when I'm on this view, without any exception.
Thanks in advance!
if any content of some tab link to a new page . the tab should be in hidden state so add this attribute "tabsHideOnSubPages" to your tab tag.
example:
<ion-tabs>
<ion-tab [tabsHideOnSubPages]="true" [root]="tab1Root"></ion-tab>
<ion-tab [root]="tab2Root"></ion-tab>
<ion-tab [root]="tab3Root"></ion-tab>
</ion-tabs>
So in this case when the first tab has button link to another page the state of toolbar tabs will be in hidden state and thats will not happen for second and third tab because the value of "tabsHideOnSubPages" attribute is false by default.

How do I navigate to a different route on a button click in Kendo MVVM

I want to navigate to a route when the user clicks a 'next' button, using Kendo MVVM, to display a view. The route will display the next page of a single page application using:
myRouter.route("/AppDetails", function () {
layoutView.showIn("#content", appDetailsView);
}
)
According to documentation: http://docs.telerik.com/kendo-ui/framework/spa/router#navigation. This code:
myRouter.navigate("/AppDetails");
should do this. Isn't it working?

Coda Slider Tab Navigation

I am using Coda-Slider for my website and I want to know if there is a way to change the content of each tab. For example, the user navigates onto tab2 where I placed a link to redirect the user to another page. Is there a way NOT to navigate away from the page nor the tab but instead load the link inside the tab? I was thinking it would look something like a modal box that would stay inside the tab instead of popping up.
see 19. Coda-Slider Sliding Tabs or you might want to try 35. JQuery IDTabs if you want the effect to be non-intrusive