Hi,
I´m new using Ionic and UI-router so maybe this is an obvious question, but it´s driving me crazy. I´m trying to implement a child state but I can´t get my child template to be displayed. I´m able to reproduce the issue based on the tabs Ionic app template.
What I changed is:
app.js:
.state(‘tab.friends’, {
url: ‘/friends’,
views: {
‘tab-friends’: {
templateUrl: ‘templates/tab-friends.html’,
controller: ‘FriendsCtrl’
}
}
})
.state(‘tab.friend-detail’, {
url: ‘/friend/:friendId’,
views: {
‘tab-friends’: {
templateUrl: ‘templates/friend-detail.html’,
controller: ‘FriendDetailCtrl’
}
}
})
.state(‘tab.friend-detail.offer’, {
url: ‘/detail/:offer’,
views: {
‘tab-friends’: {
templateUrl: ‘templates/dashDetail.html’,
controller: ‘DashDetailCtrl’
}
}
})
I created an empty DashDetailCtrl and a simple dashDetail.html template (static text). I call the tab.friend-detail.offer state by:
ui-sref=“tab.friend-detail.offer({offer:2})”
The route seems to be recognized because I don´t get redirected to the default state, but for whatever reason neither my DashDetailCtrl controller not the template are invoked. It just displays the parent template.
As a side note, based on ui-router recommendations, shouldn´t the tabs.html template use ui-sref instead of href? I understood not using URL but state names to route it´s one of the ui-router benefits.