Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First nested tab does not get selected when selecting parent tab #1276

Closed
ssassi opened this issue May 5, 2014 · 22 comments
Closed

First nested tab does not get selected when selecting parent tab #1276

ssassi opened this issue May 5, 2014 · 22 comments
Assignees

Comments

@ssassi
Copy link

ssassi commented May 5, 2014

When using nested tabs I want the first nested tab selected by default.
Please, look at this example: http://codepen.io/ssassi/pen/djGJB2. The first tab's content under home is not rendered when clicking on the Home tab.

@ajoslin
Copy link
Contributor

ajoslin commented May 6, 2014

Hi @ssassi,

Your codepen isn't working!

@ssassi
Copy link
Author

ssassi commented May 6, 2014

Sorry, a typo on the link: http://codepen.io/ssassi/pen/djGJB

@nicowenterodt
Copy link

I can confirm this: http://codepen.io/niwen/pen/kwvpr

@peterchibunna
Copy link

Yeah. If you click another tab, it works fine. but if you navigate to the first tab, or any other [as long as you just came to this tab container view] using $state.go, it doesn't render the content. The title is updated correctly.

@perrygovier
Copy link
Contributor

Confirmed this is still an issue.

@david-gang
Copy link

I have also this problem. Even the select function of the tab delegate does not help

@jobeland
Copy link

+1 happening for me as well

@jeremyalan
Copy link

I'm trying to help out with some of the leg work on this issue... it's definitely an issue caused by nested tabs, and more specifically, $scope inheritance. The value $tabSelected gets inherited from the the "outer" ion-tab, so each of the nested tabs inadvertently get rendered as selected.

I'm not sure this is the correct fix, but I was at least able to verify my conclusion by adding this to the top of the $ionicTabs controller:
$scope.$tabSelected = null;

If you disagree, I will gladly submit a pull request, but for some reason, it just doesn't quite feel right, and I wasn't able to get it working properly by adding it to any of the link functions, I ran short on time tonight, but perhaps someone more familiar with the framework will have better luck.

Please let me know if I can help any other way or if you want further clarification.

@harshitgoel96
Copy link

I have the same issue, any one has a solution for this issue ?

@peterchibunna
Copy link

I have a way around this scenario. It's a funny hack actually.
Here's what I do:
From the outer tab, navigate to any other child tab that is not the first
one; that way the first child tab will be selected whenever you come from
the outer/parent tab.

On Wed, Dec 3, 2014 at 8:57 AM, harshitgoel96 [email protected]
wrote:

I have the same issue, any one has a solution for this issue ?


Reply to this email directly or view it on GitHub
#1276 (comment).

@javifr
Copy link

javifr commented Dec 5, 2014

+1

@javifr
Copy link

javifr commented Dec 5, 2014

I'm freakin out with this issue.

Another, inherent problem, is that having a list inside a tab and clicking to a detail view, the back button returns to the first tab, not the tab where the list was.

-tab1
-tab2
-tab3
-- subtab1
-- subtab2 ( list of items )
--- item detail ( BACK BUTTON returns to tab 3 with subtab1 active, and not subtab2 )
-- subtab3

would really apreciate some help

thanks!

@adamdbradley
Copy link
Contributor

Fixed in the latest builds.

@harshitgoel96
Copy link

The problem exists in current stable release, any timeline to release the new build ?

C:\Android Dev\WORKSPACE\blaBla>ionic -v
1.2.8

C:\Android Dev\WORKSPACE\blaBla>ionic lib -v
Local Ionic version: 1.0.0-beta.13 (C:\Android Dev\WORKSPACE\blaBla\www\lib\ionic\version.json)
Latest Ionic version: 1.0.0-beta.13 (released 2014-09-24)

@harshitgoel96
Copy link

Just checked nightly 863, still having navigation issues, the first nested tab was loaded porperly, but navigation to second tab still showed the content of first tab, also once the master tab is switched, can not switch back to any other tab

structure

|
|
|
|
|

@henry74
Copy link

henry74 commented Jan 27, 2015

+1

@luisrudge
Copy link

I'm having this problem too! And I'm using the master branch. @adamdbradley is this exptected?

@ram-you
Copy link

ram-you commented Feb 13, 2015

+1

@Phoscur
Copy link

Phoscur commented Mar 3, 2015

+1 is this landing soon? Merge and define milestone please!
(With caching everything works as expected for me but app page refresh on subtabs causes overlays, very annoying - I'm gonna stop thinking of bad workarounds now; using beta14)

abruzzihraig added a commit to abruzzihraig/ionic that referenced this issue Mar 3, 2015
Like the issue ionic-team#1276 if you have some nested tabs, you select a sub-tab
item, and you will active some other siblings, because when tabCtrl add
every new $scope, it does't has a initial attr $scope.$tabSelected, so
every unselected item will read the $tabSelected from inherited $parent,
but if the parent-tab has been actived, the all of its sub-tabs
will read this true property in $scope.$tabSelected. So I think we
should initialize the property $scope.$tabSelected before invoking
tabsCtrl.add(), and every tab-item will has a 'false' status for a
initial $scope.$tabSelected.
@www-wowow-so
Copy link

ok,it's work for me~

@k1n6
Copy link

k1n6 commented Apr 27, 2017

How would I fix this issue in ionic lib v 1.x (I tried 1.24 and 1.33 with no luck)

@ionitron-bot
Copy link

ionitron-bot bot commented Sep 3, 2018

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Sep 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests