1
votes

so i'm kinda news to ionic framework, and i'm trying to make a tab-ed page inside a menu.

I follow this stackoverflow page : Ionic tabs and side menu navigation issue

And i put my code in codePen : http://codepen.io/MarcelAng/pen/KrJyYp

Here is my config :

.config(function($stateProvider, $urlRouterProvider) {
  $stateProvider
    .state('page1', {
      url: "/page1",
      templateUrl: "templates/page1.html",
      controller: "myCtrl"
    })

    .state('app', {
      url: "/app",
      abstract: true,
      templateUrl: 'templates/menu.html',
    })

    .state('app.playlist', {
      url: "/playlist",
      views: {
        'menuContent': {
          templateUrl: 'templates/tabs.html',
        }
      }
    })

    // Each tab has its own nav history stack:
    .state('app.playlist.dash', {
      url: '/dash',
      views: {
        'tab-dash': {
          templateUrl: 'templates/tab-dash.html',
          controller: 'myCtrl2'
        }
      }
    })

    .state('app.playlist.chats', {
        url: '/chats',
        views: {
          'tab-chats': {
            templateUrl: 'templates/tab-chats.html',
            controller: 'myCtrl3'
          }
        }
      })

    .state('app.playlist.account', {
      url: '/account',
      views: {
        'tab-account': {
          templateUrl: 'templates/tab-account.html',
          controller: 'myCtrl4'
        }
      }
    })

    .state('app.search', {
      url: "/search",
      views: {
        'menuContent': {
          templateUrl: 'templates/search.html'
        }
      }
    })

    .state('app.browse', {
      url: "/browse",
      views: {
        'menuContent': {
          templateUrl: 'templates/browse.html'
        }
      }
    });

  $urlRouterProvider.otherwise("/page1");
})

let me explain the flow :

  1. Login in Page1 (Just fill it with whatever you want, no checking yet in that code, DON'T LEAVE IT EMPTY !)

  2. it should redirected to tabbed page (playlist on my case)

  3. there is 2 page other in the menu (browse and search), WHICH IS NOT TABBED.

I've already make it like that flow,

the problem is, whenever i change between tab, it go back to login page magically !,

but when i change page via side menu, it working fine.

i think the .otherwise kicks in, but i don't know how to fix it.

Can anybody help me a little ?

1
what error does the console give? - Jurjen Folkertsma
nothing, there is no error. That what makes me confused. - Marcel Ang

1 Answers

0
votes

I found my mistake. I forgot to change the href in tags. It still redirecting to the old page.