Class sub-header stays active after page transition


#1

After I click on my list item(With a subheader) I go to a detail page(Without subheader).
When the transition to the new page is done, the content has been pushed down and show a blank subheader.
After investigation I noticed that the ‘has-subheader’ class is still in the new ion-content class.


Subheader in Tabnav
#2

What version of Ionic are you using? This was a bug in Beta 1, but I think it is gone now.

If not, setup a CodePen sample for us to take a look at


#3

See this sample with Beta 4.


#4

I have something like this.

In the real project is also have a ng-show on the io-header-bar:

ion-header-bar class="bar-subheader item-input-inset" ng-show="showScoreboardSubNav()">

The desired result is to show a subheader and disable it on other views.


#5

Why don’t you fork my sample and put in your scenario? The sample shows how to make it work. If your’s is significantly differently, you’ll need to give us something to work on.


#6

I did fork it, see this link: http://codepen.io/anon/pen/mKLgf


#7

Oops. Sorry I didn’t notice that.

Here is a working version. It’s a bit of a hack.

It’s using ng-if to definitively remove the subheader from the DOM on the other views. ng-show does not work because Ionic still detects the presence of the header.

This should probably work a bit better though. Ionic could be changed to detect if the subheader is actually visible though.

You might want to open an issue on this.


#8

using ng-if and adding class="has-subheader" to the ion-content has fixed the problem.

Issue is posted: https://github.com/driftyco/ionic/issues/1351


#9

It’s using ng-if to definitively remove the subheader from the DOM on the other views. ng-show does not work because Ionic still detects the presence of the header.

That was my problem in different issue ah!!! thx :slight_smile: