ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

bug: Page do not reload

Open gio82 opened this issue 11 years ago • 6 comments

Type: bug

Platform: ios 8 webview

Beta 14 At the moment I'm testing it on iOS simulator

When I first load states main.first and main.second all works fine. If I go back only the nav-bar reloads his content. The ion-content remain last one loaded.

Here some of my code:

app.js

.state('main', {
      url: "/main",
      abstract: true,
      templateUrl: "templates/main.html",
      controller: 'MainCtrl'
    })
    .state('main.first', {
      url: "/first",
      views: {
        'main-first': {
          templateUrl: "templates/main-first.html",
          controller: 'MainFirstCtrl'
        }
      }
    })
    .state('main.second', {
      url: "/second",
      views: {
        'main-second': {
          templateUrl: "templates/main-second.html",
          controller: 'MainSecondCtrl'
        }
      }
    })
    ...

main.html:

<ion-view>
  <ion-nav-view name="main-first"></ion-nav-view>
  <ion-nav-view name="main-second"></ion-nav-view>
</ion-view>
```</span>

<span is-issue-template></span>

gio82 avatar Dec 19 '14 11:12 gio82

Sounds like the view is getting cached. This is a new feature in beta-14. It can be disabled with $ionicConfigProvider, eg: views.maxCache(0). Does this help?

drewrygh avatar Dec 24 '14 22:12 drewrygh

Thanks @drewrygh for your reply. I already tried to use cache-view="false" and also using cache: false, in the state declaration but it didn't worked. At the moment I changed the structure removing the main abstract state to fix this issue and go on on the dev of my app so I'm not able to test your solution. So at the moment I fixed my issue with a workaround.

gio82 avatar Dec 25 '14 07:12 gio82

@gio82 Any chance you could put together a codepen?

mhartington avatar Dec 31 '14 18:12 mhartington

Here for you guys: http://codepen.io/anon/pen/gbLPoP

BTW: Happy new year!! :)

gio82 avatar Jan 01 '15 10:01 gio82

The issue is with how the abstract view is set up. You should only have one ion-nav-view in there.

http://codepen.io/mhartington/pen/ZYKypw

You could even go as far as remove the abstract state. http://codepen.io/mhartington/pen/mymwOW

Closing this.

mhartington avatar Jan 20 '15 03:01 mhartington

Oh, ok! Thanks for your help and sorry.

gio82 avatar Jan 20 '15 06:01 gio82