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

$state.go and $state.otherwise problem

$
0
0

@MrShakes wrote:

I'm trying to go to a page(template) using $state.go and my code in the controller.js file is:

.controller('NavCtrl', function($scope, $location, $state) {
$scope.openDaily = function() {
$state.go('daily');
};
})

It works but for only a millisecond or something as it's redirected BACK to the '/select' page because the $state.otherwise says so, the code in app.js is:

.config(function($stateProvider, $urlRouterProvider) {
$stateProvider
.state('select', {
url:'/select',
templateUrl: 'templates/select.html',
controller: 'selectController'
})
.state('daily', {
url:'/daily',
templateUrl: 'templates/daily.html',
controller: 'dailyController'
});
$urlRouterProvider.otherwise('/select');
})

What is causing this please?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 49172

Trending Articles



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