Quantcast
Channel: Ionic Framework - Ionic Forum
Viewing all articles
Browse latest Browse all 49183

Choose right view in controller or redirect to another without "redirect" history

$
0
0

@tux wrote:

Hello!
I have two type of users which have different home views.
And i need to show right one or redirect to another view
I've made a redirect.

.state('tab.home', {
  url: '/home',
  views: {
    'tab-home': {
      controller: 'HomeCtrl'
    }
  }
})
.state('tab.home-publisher', {
  url: '/home/publisher',
  views: {
    'tab-home': {
      templateUrl: 'templates/publisher/home.html',
      controller: 'HomePublisherCtrl'
    }
  }
})

.state('tab.home-creator', {
  url: '/home/creator',
  views: {
    'tab-home': {
      templateUrl: 'templates/creator/home.html',
      controller: 'HomeCreatorCtrl'
    }
  }
})

$urlRouterProvider.otherwise('/tab/home');

Main controller

.controller('HomeCtrl', function($scope, $state, $stateParams, $location) {
  // ...
  $state.go('tab.home-creator', {}, {location:'replace'});
  // ...
})

It redirects to right one. But keeping /home in history and shows back button.
How i can properly redirect, without keeping /home in history?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49183

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>