angular ui router - AngularJS not setting location state with "skipReload" -
i working on site transitioning angular - uses angular single page application navigation , new feature i'm working on written entirely in angular.
the rest of site takes navigation results , returns them through spa model, feature i'm working on runs entirely in single page, in order make links shareable , bookmarkable changes url in relation current state of page.
so when selects new subsection of new feature, have code in subsection service:
function setlocationforsubsection(subsection) { var path = subsection.id ? "subsections/" + subsection.id + "/" + subsection.urlslug : ""; $location.path("/section/" + path).search({}).skipreload(); };
if follow link elsewhere in site ( goes through $stateprovider.state('all', { url: '*urlpath?id', controller...
pattern ) works correctly.
if hit button, come correct page , setlocationforsubsection
called. if click on same link outside of subsection again, nothing happens.
so course of action occurs:
/section/2/subsection-name
<- works./news
<- works- back button (
/section/2/subsection-name
) <- works /news
fails
as far can tell, problem arises because location path setting fails push location angular state in situation, far angular concerned still on /news
, when try navigate there, doesn't pick navigation event. have tried using $window.history.pushstate(null, 'any', $location.absurl());
manually, doesn't seem make difference. if drop skipreload
call works reloads contents of page, superfluous in case. i'm using approach now, know if there better option.
is there way tell angular state change has happened in case?
Comments
Post a Comment