I have to admit I’m confused about the best way to navigate between views in my Ionic App. I’m not looking for people to write or debug my code but to guide me as to which method is recommended (if any).
I have an app with three main views and as number of sub-views off the main views. This works well using the tabs navigation as in the ‘standard’ downloaded app. The history stack is maintained and no issues. This is very, very close to the standard ‘tabs’ app that is one of the starter apps. Its pretty much spot on for our use. We’ve changed some of the names but thats about it.
e.g.
Page 1
–> Sub-Page 1.1
Page 2
–> Sub-page 2.1
Page 3
However I am now handling push notifications which can come in at any time in any view and need to ‘programatically’ move to other sub-views using JavaScript from anywhere at all with the right parameter.
I want to maintain the history stack as thats important.
So far I’ve seen and tried out
window.location.href = “#/something/#id”
or
$location(…)
or
$state.go(statename , args)
All these partially work in certain circumstances, e.g. if I’m on one of the main pages (page1) I can go to a sub page (page 1.1) and the history is maintained. However if I’m on different page (page 3) and want to go to page1.1 it appears the history is lost, i.e. no back button is presented. I’m going round in circles trying to work it out and the team is getting rather frazzled about it all 
We’ve seen and read masses of posting which all seem to go round in circles and are almost self referential. We cannot see anything in the Ionic docs which is authoritative (though we could have missed it). Its also not clear how ui-router fits into this if at all.
So is there any guide that is easy for the hard-of-understanding to work out the easiest/most recommended/best_practise way to move between views (and sub-views) using JavaScript.
Thanks,
Rob
