javascript - AngularJs : Multiple clicks on same button is not working -
i have created web page in angular js. whenever navigate other page home
page , click on home
button page navigates home
page expected , working fine. when again click on home
button i'm expecting page refresh (because home
page) not happening.
the following untested, alternative solution came with.
in routes configuration object home page (which assuming has url of /home
), specify following parameters:
{ // ... reloadonsearch: true, redirectto: function (routeparams, path, search) { if (search.redirected) { // don't redirect, return same path + search return '/home?redirected=true'; } else { return '/home'; }, // ... }
the thinking when link /home
, redirectto()
function fire , redirect /home?redirected=true
. change search parameter, route should reload correctly due specifying reloadonsearch: true
. since home page links pointing /home
, page should reload.
it's bit ugly, , cause home page controller run twice when going other page home page, if can't other way work, 1 might worth try.
Comments
Post a Comment