The State of the Page

Here is an example of setting the state of the page using the angular-ui router. The map is bound to the latitude and longitude specified in the url hash. Click on the following link, to navigate between Portland and Crater Lake.

Using the angular-ui router, the above links are written like

<a ui-sref="main({ lat:45.52, lng:-122.68 })">Portland, Oregon</a>
<a ui-sref="main({ lat:42.95, lng:-122.1 })">Crater Lake, Oregon</a>

if you have clicked a navigation link, you can see that the back button works to take you back to the last location. Note that the url fragment does not update, if you pan or zoom the map. We’re not listening for that event and relaying it back to the state.