angularjs - How to use tabs in Ionic with a abstract state parameter / clear cache on navigation -
i have home screen list of groups. each list item links same abstract state parameter (gid, groupid).
.state('group', { url: "/group/:gid", abstract: true, templateurl: "templates/group.html" }) .state('group.members', { url: '/members', views: { 'group-members': { templateurl: 'templates/group-members.html', controller: 'memberctrl' } } }) .state('group.events', { url: '/events', views: { 'group-events': { templateurl: 'templates/group-events.html', controller: 'eventctrl' } } }) .state('group.settings', { url: "/settings", views: { 'group-settings': { templateurl: "templates/group-settings.html", controller: 'settingsctrl' } } })
in abstract state have 3 tabs should work on same parameter/group. while works tab link home screen, other tabs remember history , after going home screen , selecting group linked tab shows details correct group. other tabs show details (cached) group.
i think might fixed clearing cache somewhere, ideally not want clear each time each tab. while navigating between tabs in same group cache should used. when going home screen , after new group selected should cache of tabs cleared.
an alternative might somehow make other views aware new group has been selected. tab linked easy: parameter given in url. others not linked home screen. there way pass argument ion-tabs in template file?
what best approach getting work? must use case occurs , , suspect there preferred way handling it. using ionic 1.0.0. thanks.
the group-members
view being updated, rest of groups
view stale. adding cache: false
state in codepen below worked fine.
javascript .state('group', { url: "/group/:gid", abstract: true, cache: false, templateurl: "templates/group.html" })
see $ionichistory.clearcache() @ http://ionicframework.com/docs/api/service/$ionichistory/
Comments
Post a Comment