As the title says, how do you do this? I have tried $state.go(); and passed my relevant view in but that doesn’t work. When I navigate back to the view the url changes accordingly which I assume that the routing is working fine but the app doesn’t show the correct view, only when I refresh the page in the browser does the view appear 0 any ideas?
yeah … disable the cache view on that page
http://ionicframework.com/docs/api/directive/ionNavView/
section “Caching”
or trigger an event like
$state.go('app.home').then(function() {
$rootScope.$broadcast('refreshHomeEvent');
});
@coreelements I think disabling the cache-view is a bad idea for the performance of your application. An event with a refresh-view is more appropriate.
true …
just giving him the options
Thanks guys but I have tried that on the route and the html like the examples in the links @coreelements posted but those don’t work, am I missing something here?
you do have an event listener on the target page?
show some code
no I don’t - ok here’s my code
.state('home', {
url: '/homePage',
cache: false,
views: {
'homePageContent': {
templateUrl: 'homePage.html',
controller: 'homePageCtrl'
}
}
})
<div class="has-header">
<ion-nav-view name="homePageContent" cache-view="false" class="has-header"></ion-nav-view>
<ion-nav-view name="addExpenseContent" class="has-header"></ion-nav-view>
<ion-nav-view name="addIncomeContent" class="has-header"></ion-nav-view>
<ion-nav-view name="editExpenseContent" class="has-header"></ion-nav-view>
</div>
you’ll notice me trying the cach-view=“false” both in the routing and the html but it doesn’t work, I will have to use your event listener method if that works, I did create a function on the main controller that takes a view as an argument here’s the code for that method
$scope.goToView = function(view){
console.log($state);
$state.go(view);
}