After I clicking home button or home link sometimes it displaying back button


#1

Hi,

I created a app and it working pretty good .,

but my only issue is with sidemenu icon , I have multiple pages in that I used sub-header with home button link so that user can easily go to their home page by one click.

what my problem is when I am trying to click the link instead of home button its showing back button …

and some times it displaying empty space nothing is displaying over there.


#2

then you should think about your navigation structure of your app… sounds like it is not working like expecting, because the navigation flow is incorrect.

Like, if you go to the startpage, you should clear ionic history and so on.


#3

Thanks for the Reply @bengtler ,

Links are working fine, but only thing i got the error is back button issue and it appears in the home page also … And sometime the sidemenu is hide.,

Sorry troubling you I have tried some clearhistory();methods but dunno where the problem is ?

so can you please send me some code regarding to clear history.

Thanks


#4

Hey Pyraminds

I don’t know if i got your issue, but try this :slight_smile:
Ionic has multiple navigation stacks, so the tab, and header has their own navigation stack. When navigating from a simple page, just use “this.navCtrl.popToRoot();” is enough to back to your home page and clearing your navigation stack. But if you are navigating from an inner page like subheader page. tab pages, you get involve others navigation stacks and the normal page navigation stack. So in the case to go back to your home page cleaning all stacks you need to do this: “this.navCtrl.parent.parent.popToRoot();”

I really hope that will help :slight_smile:


#5

thanks for the reply @quieterkali

I am new to this development. so where can I use this samples you provided,

And one more thing is some times when I am navigating to home page the menu icon is disappearing from the page

but functionality is working when I am clicking on the menu icon place.


#6

No worry, I am new too. Just trying to help. Put that code in your controller, in the method that will be call when click on a button.


#7

hello @quieterkali ,

the navigation is going well when I am clicking the previous tab but when I am trying to call the home page from a page in between one more page is there’s I am facing problem over there.,

And I add the code you provided in my controllers actually I have a 8 controllers, and it showing blank page with multiple errors like undefined is not an object (evaluating ‘this.navCtrl.parent’) like this… the menu icon is also disappearing sometimes from home page .

thanks for your help.


#8

Okay, but you know each page has it own controller, so you will need to do this in any page you need to get back to the home page. And tell me are using the right name for “navigation controller”, i use to name mine “navCtrl” but your can be other. And please do you think that you can post the html and controller of one of the page from where you get that issue?


#9

sure @quieterkali
basically I didn’t use any controller for navigation but every page contains a controller .,
below is the sample code I placed your code.

this is my workshop_info.html page :

I place some links in the sub header bar like this and I am trying to navigate them .

<ion-header-bar class="bar bar-subheader bread">
<h6 ng-repeat="workshop in workshops | filter: {id : workshopId}">

HOME | PROGRAMS | {{workshop.title}}

this is my controller I am suing in the workshop_info.html page

app.controller(‘workshopCtrl’, function($scope, $state) {
$scope.workshops = [
my workshops list I placed here
];
this.workshopCtrl.parent.parent.popToRoot();

$scope.workshopId = $state.params.workshopId;

});


#10

Oh my friend, i thought you were using ionic2(lol), so basically in ionic1 the navigation is by URI. Try to desactivate the back button for your home page html.

You don’t need to use the code i sent to you till now. just try what i said and we will see what happen :slight_smile:


#11

hey @quieterkali,

Sorry for not mentioning that i am using ionic1 .

And i have workout what you said , but it didn’t solve my issue ,

when i deactivating the back button in home page, there is an empty space coming in that area … that menu icon is not displaying.may be this is happening because i have mentioned the code enable-menu-with-back-views="false" so the menu icon not appear in any other page.

the menu icon is coming when i am clicking the home link which is placed immediate pages or pages coming through home page. but i am trying to call from the sub pages of home page sub pages its showing only back button instead of menu icon.


#12

Hi @quieterkali,

I want to let you know one more thing that when I am navigating from my side menu the menu icon or back button icon is not appearing on the header bar. I will post my code below .

       <ion-side-menus enable-menu-with-back-views="true" style="background-color:#F8E974">
  <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-header-bar class="bar-stable sidemenu">
  <img src="img/New/logo.png" width="100%" style=""/>
</ion-header-bar>
<ion-content>
  <ion-list>
    <ion-item menu-close href="#/app/home">Home
    </ion-item
    <ion-item menu-close href="#/app/about">About US
    </ion-item>  

`

may I know the reason or solution for this.