javascript - Retain parent state in AngularUI Router -
i'm developing application angularjs has phonebook. state page.phonebook
contains list users , companies , form filters. data loaded via ngresource backend. if click on user, i'm getting users detail page. when browser (backspace), i'm getting phonebook list, new $scope
. means lost old state filters, data, etc.
i guess problem load state page.phonebook.user
in page
view, replaces page.phonebook
state.
but somehow possible retain old state? includes scroll position, filter values , data server.
this state configuration:
$stateprovider .state('page', { abstract: true, controller: 'pagecontroller', templateurl: 'app/templates/page.html', }) .state('page.phonebook', { url: "^/phonebook", templateurl: 'app/templates/page.phonebook.html', controller: 'phonebookcontroller' }) .state('page.phonebook.user', { url: "^/user/:userid", views: { '@page': { controller: 'usercontroller', templateurl: 'app/templates/page.user.html' } } });
you can maintain state. need persist filters, , scrolling position part of stateparams or service. once navigating between pages can retrieve back.
Comments
Post a Comment