View caching issue when redirecting to the page by an anchor tag


#1

I have a really weird problem here. Basically I have 2 views (app.map and app.list) which both have caching on. I am using side menu template. So, I have the link below on my side menu:

<ion-item nav-clear menu-close href="#/app/list" class="item item-icon-left">
             <i class="icon ion-ios-list"></i>
                List
            </ion-item>

And link below on my other (app.map) page:

 <a class="button button-icon ion-ios-list" href="#/app/list"></a>

Basically they are both redirecting to the app.list state but the interesting thing is: When I use the button in side-menu caching is working for the app.list state but when I use the anchor button on the page itself it is not. Do someone have any idea?


#2

If you feel this might work for you, you can try similar to

<div class="button button-icon ion-ios-list" ng-click="clicked()"></div>

In your controller

$scope.clicked = function(){
   $state.go('app.list');
};

#3

You will often run into ‘< Back’ button problems if you use ‘href’. The Ionic framework uses the angular-ui-router module for handling routes and defining states (including nested states and nested views) so you need to use ‘ui-sref’ or ‘$state.go()’.

<ion-item nav-clear menu-close ui-sref="app.list" class="item item-icon-left">
    <i class="icon ion-ios-list"></i>
    List
</ion-item>

<a class="button button-icon ion-ios-list" ui-sref="app.list" ></a>

Ref: