app.js
.config(function($stateProvider,$urlRouterProvider){
$stateProvider
.state('Login',{
url:'/login',
onEnter:["$state","$localStorage", '$rootScope' , '$ionicViewSwitcher', function($state,$localStorage, $rootScope, $ionicViewSwitcher){
if((typeof($localStorage.userInfo)!== 'undefined') && (Object.keys($localStorage.userInfo).length !== 0)) {
$ionicViewSwitcher.nextTransition('none');
$state.go("Deployment");
}
}],
templateUrl:'templates/login.html',
controller:'LoginCtrl'
})
.state('Deployment',{
url:'/deployment',
templateUrl:'templates/deployment.html',
cache : false
})
.state('Bill',{
url:'/bills',
templateUrl:'templates/bills.html',
cache : false
})
$urlRouterProvider.otherwise(function ($injector) {
var $state = $injector.get('$state');
$state.go('Login');
});
});
控制器:
$scope.billsDetails=function(deploymentId,startingDate,name){
$state.go('Bill', {}, {reload:true});
}
当它进入状态Bill
时,网址会从之前状态的网址更改。比尔的那个,然后立即改为localhost:8100/#
。
那是:
1。localhost:8100/#/urlOfPreviousState
localhost:8100/#Bill
localhost:8100:/#
即使它保持在Bill状态,url也会更改为#。我担心因为它会产生后退按钮的问题。在第一次点击后退按钮时,它会进入
/#/Bill
以及/#/urlOffpreviousState
答案 0 :(得分:1)
只需改变这样的状态:
$state.go('Bill');