I have a problem with navigating in my app since I have updated Ionic to Beta 14. To reload the next page I use the function $state.go() with reload : true or to reload the current page the function $state.reload(). To disable caching I use the new service with $ionicConfigProvider.views.maxCache(0).
When the page is reloaded, the nav-bar is hidden with class="hide" in ion-nav-bar. I tried to handle this by setting hide-nav-bar="false" in the ion-view, but in the tag ion-header-bar the class disable-user-behaviour is set automatically.
I edited the Codepen example āSidemenu and Navigation: Nightlyā (http://codepen.io/ionic/pen/QwamEW) with the following code to reproduce the problem:
HTML:
<script id="templates/event-menu.html" type="text/ng-template">
<ion-side-menus enable-menu-with-back-views="false">
<ion-side-menu-content>
<ion-nav-bar class="bar-positive">
<ion-nav-back-button>
</ion-nav-back-button>
<ion-nav-buttons side="left">
<button class="button button-icon button-clear ion-navicon" menu-toggle="left">
</button>
</ion-nav-buttons>
</ion-nav-bar>
<ion-nav-view name="menuContent"></ion-nav-view>
</ion-side-menu-content>
<ion-side-menu side="left">
<ion-header-bar class="bar-assertive">
<h1 class="title">Left Menu</h1>
</ion-header-bar>
<ion-content>
<ul class="list">
<!-- Note each link has the 'menu-close' attribute so the menu auto closes when clicking on one of these links -->
<a href="#/event/home" class="item" menu-close>Home</a>
<a href="#/event/content" class="item" menu-close>Content</a>
</ul>
</ion-content>
</ion-side-menu>
</ion-side-menus>
</script>
<script id="templates/home.html" type="text/ng-template">
<ion-view view-title="Welcome">
<ion-content class="padding">
<p>Swipe to the right to reveal the left menu.</p>
<p>(On desktop click and drag from left to right)</p>
</ion-content>
</ion-view>
</script>
<script id="templates/content.html" type="text/ng-template">
<ion-view view-title="Content">
<ion-content>
<button ng-click="click()">Home</button>
</ion-content>
</ion-view>
</script>
Iām having a similar issue except Iām using $ionicConfigProvider.view.transition(ānoneā) and am experiencing my nav-bar and itās buttons gone from each page/state.
I wrote an app based on tabs seed. I used statusbar plugin, created my statusbars in my views, but I got the annoying thing. The nav-bar disappears constantly. How?
I launch my app, login and display the dashboard screen.
Close the app or reinstall with (ionic run ios)
App opens but without nav-bar (itās hidden)
I found this issue and yes I use $state.go with cache disabled but the issue is random and it happens on both platforms.
This is production showstopper for me. I try to find some workaround but the FIX is needed here, fast.
This is still an issue for me in 1.0.0. Hereās the line that hides the nav bar, at least in my case:
Comment it out and it doesnāt hide the bar. Still trying to come up with a fix. Overriding the .hide class with something doesnāt work in all cases.
I have the same issue, but wasnāt able to replace my navbar with headerbar.
My workaround was to remove reload: true from my $state.go call and add a new state parameter to allow reloads: cb: (new Date()).getTime(). It is now working for me with v1.0.0
For those desparate for a cosmetic workaround, Iām currently doing something along the lines of this:
// Fix the disappearance of the nav bar on return to app.
setTimeout(function(){
if($('ion-nav-bar').hasClass('hide')){
$('ion-nav-bar').removeClass('hide');
$('ion-view').css('padding-top','44px');
$('ion-content').css('margin-top','43px');
}else{
$('ion-view').css('padding-top','0');
$('ion-content').css('margin-top','-1px');
}
},1000);
This code probably looks dumb in a number of ways but you get the idea. You could have your controller do these cosmetic cleanups (or better ones) depending on if your controller should or should not show a nav-bar for that particular state.