I have done this, you just need to define a state for each of the possible detail views. For example:
In my application I have a detail view that can be accessed from more than one tab.
- templates/ride-detail.html
I have two tabs that can access the above detail view:
and they have states defined as below:
.state('tab.profile', {
url: '/profile',
views: {
'tab-profile': {
templateUrl: 'templates/tab-profile.html',
controller: 'ProfileCtrl'
}
}
})
.state('tab.rides', {
url: '/rides',
params: {
issearch: null,
radius: null
},
views: {
'tab-rides': {
templateUrl: 'templates/tab-rides.html',
controller: 'RidesCtrl'
}
}
})
To enable the ride detail view to be accessed from the two above tabs I defined two states for this as below:
.state('tab.ride-detail', {
url: '/rides/:rideId',
views: {
'tab-rides': {
templateUrl: 'templates/ride-detail.html',
controller: 'RideDetailCtrl'
}
}
})
.state('tab.profile-detail', {
url: '/profile/:rideId',
views: {
'tab-profile': {
templateUrl: 'templates/ride-detail.html',
controller: 'RideDetailCtrl'
}
}
})
Then from the rides tab I call code below to get to detail view:
$state.go('tab.ride-detail', {
rideId: rideid
});
and from profile tab call:
$state.go('tab.profile-detail', {
rideId: rideid
});
Then in your view you can have ng-click="godetail(checkinId)"
and then change state call depending on the controller that the godetail function calls into, so in my case when godetail is called from profile tab:
$scope.godetail = function (rideid) {
$state.go('tab.profile-detail', {
rideId: rideid
});
};
and when called from rides tab:
$scope.godetail = function (rideid) {
$state.go('tab.ride-detail', {
rideId: rideid
});
};
Hope this helps.