$location service should utilize onhashchange events instead of polling

This commit is contained in:
Igor Minar
2011-01-04 17:54:37 -08:00
parent c0a26b1853
commit 16086aa37c
9 changed files with 187 additions and 49 deletions

15
test/angular-mocks.js vendored
View File

@@ -63,8 +63,23 @@ function MockBrowser() {
this.isMock = true;
self.url = "http://server";
self.lastUrl = self.url; // used by url polling fn
self.pollFns = [];
// register url polling fn
self.onHashChange = function(listener) {
self.pollFns.push(
function() {
if (self.lastUrl != self.url) {
listener();
}
}
);
};
self.xhr = function(method, url, data, callback) {
if (angular.isFunction(data)) {
callback = data;