URL Anchors
An application page needs to be bookmark-able. This means that the URL needs to have all of the information necessary to reconstruct the page when it is reloaded. This usually means that we need to store the current document Id in the URL.
URL Format
The url is in the format of http://serverName/template.html#anchor. Everything after the # is considered an anchor. The anchor is in the form of key value pairs like this key1=value1&key2=value2. There can be any number of key value pairs present in the URL like this http://serverName/template.html#userId=12uoi893nh5&cdId=397itht2d39.
Working with the Anchor
The anchor is automatically parsed and updated by the framework. The parsed version of the anchor is stored in the $anchor key in the root scope. Notice how the same template will display different results depending on the URL anchor. Click on these links (#name=Mary and #name=John) and notice the change in the URL as well as a change in the name below. Now try changing the text field and notice that the URL is updated as well.
Similarly assigning to the anchor will update the URL.