Passing data from child tab to parent tab in Ionic 2 - ionic-framework

I know we can pass data to the child tab from parent tab by doing following as described here:
<ion-tabs>
<ion-tab [root]="chatRoot" [rootParams]="chatParams" tabTitle="Chat" tabIcon="chat"><ion-tab>
</ion-tabs>
Is there any way I can do the reverse stuff i.e passing the data from child tab to parent tab.
I have the following scenario:
1. I have "next" button on the the Tabs(parent) page.
2. When user selects the value on the child page then I need to navigate the user to next page based on the selected value when he clicks next.

I have met your problem. you should use Events in Ionic 2 for sending and responding to application level across your app. So you can send data from child tab to parent tab and update status for it.

Related

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.

Ionic custom back URL

I have 2 - 3 pages that are a child section within a page, similar to tabs. Logically the user would not expect to go back to the previous tab on the back click. As these are implemented as separate pages the user is taken back to the individual tabs and not to the main section.
How can I get the user back to a custom URL only for some pages?
When you go to a new tab, you could delete the previous one from history with :
$ionicHistory.removeBackView();
Docs
If you want to custom your back function in devices i recommend this:
$ionicPlatform.registerBackButtonAction(function,priority)
In that function you can use $state.go to redirect where ever you want.
Docs here
You can skip back navigation history by using ui-view instead of ion-nav-view component.
So if for example you were using:
<ion-tabs>
<ion-tab ui-href="state">
<ion-nav-view name="content"></ion-nav-view>
</ion-tab>
</ion-tabs>
You would turn it into:
<a ui-sref="state">Link</a>
<div>
<ui-view name="content"><ui-view>
</div>
It will require some more template layout changes but this should get you started. Basically if you use ion-nav-view you'll get history and ionic.view events, if ui-router only then just view changes.

Ionic either doesn't show back button or page doesn't load at all

I am trying to create a new page from an existing page with a back button. I have recreated the issue here in a plunkr. In the trip analytics option When I click the first card i.e. Enter Home address. I want the todayDetail .html page to come up with a back button. I have already tried two approaches
First approach The ng-click approach. In which I give $state.go(statename) to give that page. But then I wouldn't get a back button as the navigation stack is changed.
Second approach - If I keep the navigation stack i.e. keep the state name as initial.trips.today.todayDetail. The page doesn't load at all.
What is the issue? How should I go about it?

How to add multiple pages to single page navigation bar in dotCMS

I created two individual pages - a "home" and a "product" page. I want to add these to a page navigation bar. So, this page should contain a navigation bar and two menu elements named "HOME" and "PRODUCT".
How can I achieve this using dotCMS?
In the page properties, check the box "show on menu" for both your pages. Then you can use the navigation tool ($navtool) to build your navigation. See this page in the documentation:
http://dotcms.com/docs/latest/NavigationTool

two view in the same page

I am working with asp.net MVC2, I'm new in development. net
I have a view that contains 2 dropdownlist and a button, I want when I click the button, another view is displayed, I want both to appear on the same page
There is two way you can implement this
1) With Complete post back you can use Html.RenderAction or load the partial view. You can use some flag to differentiate between the first time page load and post back
2) You can use the jquery AJAX and call the controller action of another View and get the content and write it to the div of the page .
Please do some research work on both and I think you can get the result as you want.