angularjs - How to preserve state of hidden views? -
i'm angular newbie working on phonegap application few views: map, list, , search.
as user interacts, each view accumulates ui state: map dragged, list gets scroll position, detail view opened list item, search performed, etc. i'd user able navigate among views without losing state.
when put views in partials in ng-view, , nav links use href="#/path"
, or ng-click trigger location.path(path)
, controller run , state obliterated. makes sense.
one option ng-include partials in index.html , ng-show based on user's nav actions. however, i've found kind of complexity in dom lead poor phonegap performance. feels eschewing routing, i'm losing 1 of main benefits of using angular.
another thought: nav clicks cause traversal of browser history. seems tricky maintain state of views in parallel, however.
my question: there pattern this?
fwiw using phonegap 3.0 , angular 1.1.5. time.
if want preserve state of dom in parallel views, there's extension ui-router called ui-router-extras. has a nice demo state transitions , full dom preservation when switching among tabs.
Comments
Post a Comment