I use a UI router in my application, and I would like a simple "scrollTo" to snap to the binding when the URL / state changes. I do not want to load the next step from the template or load a new controller. I would like for several divs to be on the page already and scroll up and down between them. This will be a simplified view of HTML.
<div id="step1"> <button ng-click="moveToStep2()">Continue</button> </div> <div id="step2"> <button ng-click="moveToStep3()">Continue</button> </div> <div id="step3"> Step 3 content </div>
So, when you enter the page, the URL will be domain.com/booking
When you press the first button, I would like my controller code to change the URL to domain.com/#/step-2 and scroll down to the "step2" section.
Ideally, when a user clicks the back button, he returns to the first URL and scrolls back to step 1.
Does anyone know how to do this?
source share