angularjs - Navigate from one tab to a nested view of another tab -
is possible link 1 tab nested view in tab? i've tried 2 different methods , neither seem work.
here's router config:
.config(function($stateprovider, $urlrouterprovider) { // ionic uses angularui router uses concept of states // learn more here: https://github.com/angular-ui/ui-router // set various states app can in. // each state's controller can found in controllers.js $stateprovider // setup abstract state tabs directive .state('tab', { url: '/tab', abstract: true, templateurl: 'templates/tabs.html' }) // each tab has own nav history stack: .state('tab.dash', { url: '/dash', views: { 'tab-dash': { templateurl: 'templates/tab-dash.html', controller: 'dashctrl' } } }) .state('tab.chats', { url: '/chats', views: { 'tab-chats': { templateurl: 'templates/tab-chats.html', controller: 'chatsctrl' } } }) .state('tab.chat-detail', { url: '/chats/:chatid', views: { 'tab-chats': { templateurl: 'templates/chat-detail.html', controller: 'chatdetailctrl' } } }) // if none of above states matched, use fallback $urlrouterprovider.otherwise('/tab/dash'); });
in templates/tab-dash.html have link particular chat detail page:
<ion-view view-title="dashboard"> <ion-content class="padding"> <h1>my chats</h1> <a href="#/tab/chats/1">chat #1</a> </ion-content> </ion-view>
from here can navigate chat detail page, if click "chats" tab button @ bottom nothing @ happens. i'd bring me main chats page.
another method tried using ui-sref instead of href:
<ion-view view-title="dashboard"> <ion-content class="padding"> <h1>my chats</h1> <a ui-sref="tab.chat-detail{chatid:1}">chat #1</a> </ion-content> </ion-view>
in case receive error could not resolve 'tab.chat-detail{chatid:1}' state 'tab.dash'
what's best way link "detail" view within tab? main make sure clicking tab button @ bottom brings me parent page tab. right now, in first example, gets stuck on "detail" view.
Comments
Post a Comment