title: AngularJS $location replace() replacing last history entry also
body: <p>On my AngularJS application I need to save only state changes in the browser history. That's why when I'm changing parameters of $location, I'm using replace() method.</p>
  
  <p>For example, When I'm accessing /page1, it is save in the history. 'centre' parameter is added automatically with replace() so it doesn't add a new history entry:</p>
  
  <pre><code>$location.search('centre', hash).replace();
  </code></pre>
  
  <p>Every time I move a map, 'centre' changes.</p>
  
  <p>When I go to /page2, the new entry in the history is created. When I move map, 'centre' changes.</p>
  
  <p>The thing is that when I press BACK button, I'm going to /page1 but I need to keep 'centre' the same as it was before, but it changes to what was saved together with history entry of /page1.</p>
  
  <p>How would I fix this issue?</p>
  
  <p>I tried to add:</p>
  
  <pre><code>$window.history.replaceState({}, '', $location.absUrl());
  </code></pre>
  
  <p>After I do replace(), but didn't work.</p>