Tabs do not work inside ionContent
I'm not sure if this is by design or not, but if you use <ion-tabs> inside of <ion-content> the tabs will render initially but not be able to switch between tabs. Removing the <ion-content> directive makes the tabs functional. Also, the tabs do not pick up the existing ionNavBar and add padding, so I have to apply CSS.
Example: http://codepen.io/gnomeontherun/pen/oluLx?editors=101
Hi @gnomeontherun - your codepen seems to work as intended? Did you forget to save something?
@ajoslin I must have accidentally saved it after removing the ion-content directive, I put it back and saved.
Still not working in beta.2 - not sure about this.
What's your use case?
I came into this when I was trying to build out a view that had tabs and just used the ion-content directive to wrap the view. It doesn't appear to be needed, but at the least if they are not compatible then the docs should probably mention that.
The problem is because <ion-content> creates an inner div, which the content is placed in, that does not have any height by default.
So the tab items, which have bottom: 0; css, end up going at the bottom of their parent element. Which in this case is the very top of the screen.
I'll add a note to the docs.
Some news?
Why is the issue closed?
I use it with ion-pane instead ion-content (solved). But now ion-tab pane needs margin-top: 50px because I don't see the tab content. I opened a new issue: https://github.com/driftyco/ionic/issues/2629
Hi ! I had the same problem, I fixed it like this.
<ion-view view-title="Tabs">
<ion-pane>
<ion-tabs class="tabs-top">
<!-- Tab 1 -->
<ion-tab title="Tab 1" href="#/tab/tab1">
<ion-nav-view name="tab-tab1">
<ion-content>
Tab 1 content
</ion-content>
</ion-nav-view>
</ion-tab>
<!-- Tab 2 -->
<ion-tab title="Tab 1" href="#/tab/tab2">
<ion-nav-view name="tab-tab2">
<ion-content>
Tab 2 content
</ion-content>
</ion-nav-view>
</ion-tab>
</ion-tabs>
</ion-pane>
</ion-view>
thanks @gregoiremotot :+1: it's worked for me!
Hi
I added a div below the ion-content
<ion-view title="Tabs"> <ion-content> <div class="list" style="margin-top:28px;"> </div>
Will this solve the problem