The user clicks for example on this link: account/organisations/organisation1/news/21
I then redirect the user via $location.path(url) from the startpage (news/today) to that specific page. If the user now presses the back button he gets back to news/today but should be redirected to account/organisations/organisation1/news/
My attempt to split the url and push the States to 'fake' the history doesn't work:
var url = "account/organisations/Vereinsplaner/news/21".split("/");
var curUrl = "";
var part;
while(part = url.shift()){
curUrl = curUrl+"/"+part;
$location.url(curUrl);
$location.replace();
$window.history.pushState(null, 'any', $location.absUrl());
}
Background: I get this link via PushNotification in an Ionic App. When the user clicks on it, he will be redirected to the subpage but cannot go back (because no history is available).
$state.go()with the returned promise. Exactly what i was looking for. I don't know if it is the most beautiful solution but it works ;)