angular ui router - AngularJS Route: when switching through routes, form becomes empty after re-loading the page? -



angular ui router - AngularJS Route: when switching through routes, form becomes empty after re-loading the page? -

i have simple app built angularjs routes loading controller , template each path. have register form , login form on separates paths/templates. go login form (/#/login) , come in username/password, if nail "register" (redirects me /#/register), , nail in browser, homecoming me /#/login form empty; info typed in has been removed.

expected behaviour form info still there.

anyway create happen (without manually caching info in service)?

i'm guessing when page changes, angular tossing old template info , reloading template again. there way instead cache page template/dom , reload when user returns path (instead of downloading , showing new template file)?

well, bit tricky. browser should implement kind of feature out of box. firefox started doing work around "issue" don't know current status of it.

alternatively can utilize bit of javascript localstorage create works. you're using angularjs can create directive encapsulates feature used on multiple places.

basically need create mechanism translate field , unique-identifier , value. every time user type on field, update store. if user "finish" interaction on form, clean value store.

you can grab jquery plugin , create directive uses plugin. https://github.com/kugaevsky/jquery-phoenix (never tested it).

tl:dr

there's nil can't using dom property/attribute or similar. you'll need hands dirty on javascript create happen.

angularjs angular-ui-router

Comments

Popular posts from this blog

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

mediawiki - How do I insert tables inside infoboxes on Wikia pages? -

Local Service User Logged into Windows -