title: Hide and show elements using `location.hash` value
body: <p>I have 2 simple div elements.I need to hide and show it based on url.</p>
  
  <pre><code>&lt;div ng-app="myApp" ng-controller='myController'&gt;
    &lt;div ng-show="addnotes" class="block"&gt; 
     paragraph 1
    &lt;/div&gt;
  
    &lt;div ng-show="!addnotes" class="block"&gt;
    paragraph 2
    &lt;/div&gt;
  
    &lt;button ng-click='clickme()'&gt;
    Add Notes
    &lt;/button&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>on page load <code>paragraph 2</code> div element will be displayed.when I click on <code>Add notes</code> button,I need to add <code>location.hash</code> value as <code>addnotes</code>.Once I added this condition should be changed to <code>$scope.addnotes=true;</code> so div elements will be toggled.</p>
  
  <p>I have done this and its working fine.
  But my problem is , its working only if i refresh the page after adding hash value.</p>
  
  <p><code>I need to do this without refreshing the page</code>.How can I do it? Any help thanks!!</p>
  
  <p>sample fiddle:<a href="https://jsfiddle.net/70Luf7hu/59/" rel="nofollow noreferrer">https://jsfiddle.net/70Luf7hu/59/</a></p>