Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Closed
Prev Previous commit
Next Next commit
fixup! fix($location): avoid unnecessary $locationChange* events du…
…e to empty hash
  • Loading branch information
gkalpak committed Jul 26, 2018
commit d736771686e672bb05e94e40a47c9b4b64a05050
2 changes: 1 addition & 1 deletion src/ng/browser.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
/* global getHash: true, stripHash: false, trimEmptyHash: true */
/* global getHash: true, stripHash: false */

function getHash(url) {
var index = url.indexOf('#');
Expand Down
5 changes: 3 additions & 2 deletions src/ngMock/angular-mocks.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

/* global routeToRegExp: false, trimEmptyHash: false */
/* global routeToRegExp: false */

/**
* @ngdoc object
Expand Down Expand Up @@ -225,7 +225,8 @@ angular.mock.$Browser.prototype = {
state = null;
}
if (url) {
this.$$url = trimEmptyHash(url);
// The `$browser` service trims empty hashes; simulate it.
this.$$url = url.replace(/#$/, '');
// Native pushState serializes & copies the object; simulate it.
this.$$state = angular.copy(state);
return this;
Expand Down