The following is my ui-router configuration. I hope that the child controller will be executed when I change the child state every time. But now, the child controller be executed only the first time I change the child state.
Is someone could help me?
$stateProvider
.state('tab', {
url: '/tab',
abstract: true,
templateUrl: 'views/tabs.html'
})
.state('tab.order-foods',{
url:'/order-foods',
views:{
'tab-order-foods':{
templateUrl:'../views/tab-order-foods.html',
controller:'orderFoodsCtrl'
}
}
})
.state('tab.cart',{
url:'/cart',
views:{
'tab-cart':{
templateUrl:'../views/tab-cart.html',
controller:'cartCtrl'
}
}
})
.state('tab.orders',{
url:'/orders',
views:{
'tab-orders':{
templateUrl:'views/tab-orders.html',
controller:'ordersCtrl'
}
}
})
.state('tab.mine',{
url:'/mine',
views:{
'tab-mine':{
templateUrl:'views/tab-mine.html',
controller:'mineCtrl'
}
}
});
$urlRouterProvider.otherwise('/tab/order-foods');
Check these:
And you will see, that ionic does cache all the stuff for us. To avoid we can
cache: false,
$ionicConfigProvider.views.maxCache(0);