Ionic v1 tabs history


#1

Hi. I’m developing my first app with Ionic v1 and now I have a little problem. Let me explain.
I have 3 tabs home,tab2,tab3.
On home tab I have 1 deeplink which is normally from the tab2 content and when I click on the link it goes to /tab2/deeplink. Here comes the problem, because after I click on the tab2 the history is the content from /tab2/deeplink/ not the content from /tab2.
Also if I go from home > /tab2/deeplink and after that on tab1 > tab2 it shows the content from /tab2/deeplink/ and if I click back it goes to /tab1/

Normal should be:
Home > /tab2/deeplink --> clicking back should go to Home
Tab2 > The content > /tab2/deeplink --> clicking back should go to Home.
Hope you understand! Thank you!

.state(‘tabs.home’, {
url: ‘/home’,
views: {
‘home-tab’: {
templateUrl: ‘templates/tab-home.html’,
controller: ‘HomeCtrl’
}
}
})
.state(‘tabs.articles’, {
url: ‘/articles’,
views: {
‘articles-tab’: {
templateUrl: ‘templates/tab-articles.html’,
controller: ‘ArticlesCtrl’
}
}
})
//Read Article Page
.state(‘tabs.read’, {
url: ‘/read/:articleUrl’,
views: {
‘articles-tab’: {
templateUrl: ‘templates/read-article.html’,
controller: ‘ReadCtrl’
}
}
})

From Home I’m going to tabs.read. From tabs.articles I can also go to tabs.read!


#2

on clicking of deeplink from home, you have to use $state.go('tabs.read'). This should go back to home on back click.
Otherwise, If you want to get back to home from the deeplink page at all times, you have to override the backbutton action to go to the home view on the controller of the deeplink page.

Secondly, to remove history, you have to disable cache for that view
Disable cache within state provider

$stateProvider.state('tabs.read', {
   cache: false,
   url : '/myUrl',
   templateUrl : 'my-template.html'
})

or, Disable cache with an attribute

<ion-view cache-view="false" view-title="My Title!">
  ...
</ion-view>

#3

Thank you! I’ve tried this solution and it works If I go to tab.readarticles but I need to go dipper like /tab/read/articleId and with $state.go I can’t make it work.
The same /tab/read/articleId links are inside tab.readarticles.
Edit:
deeplinking solved with $state.go(“tabs.read”, { articleUrl: a });
but if I click on the bottom tab it still goes to the article I clicked from the first page. Its not showing the list with articles!


#4

What is the name of the bottom tab and which page it should supposed to go to


#5

From home should go to

//Read Article Page
.state(‘tabs.read’, {
url: ‘/read/:articleUrl’,
views: {
‘articles-tab’: {
templateUrl: ‘templates/read-article.html’,
controller: ‘ReadCtrl’
}
}

})

When I’m on tabs.read from Home my Articles Tab is selected. Also from Articles Tab I can go to tabs.read

//Articles Page
.state(‘tabs.articles’, {
url: ‘/articles’,
views: {
‘articles-tab’: {
templateUrl: ‘templates/tab-articles.html’,
controller: ‘ArticlesCtrl’
}
}
})