Skip to content

Commit

Permalink
search: fix location issue, delay search restore to be sure all locat…
Browse files Browse the repository at this point in the history
…ionSearch events are handled
  • Loading branch information
fgravin committed Apr 14, 2015
1 parent e383a4b commit 151ab05
Showing 1 changed file with 8 additions and 3 deletions.
Expand Up @@ -6,15 +6,17 @@
module.service('gnSearchLocation', [
'$location',
'$rootScope',
'$timeout',
'gnGlobalSettings',
function($location, $rootScope, gnGlobalSettings) {
function($location, $rootScope, $timeout, gnGlobalSettings) {

this.SEARCH = '/search';
this.MAP = '/map';
this.METADATA = '/metadata/';
this.HOME = '/home';

var state = {};
var that = this;

/** ---- get methods from $location ---- **/
this.absUrl = function() {
Expand Down Expand Up @@ -88,7 +90,11 @@

this.restoreSearch = function() {
this.setSearch(state.lastSearchParams);
this.lastSearchUrl = '';

//Wait all location search are triggered
$timeout(function () {
that.lastSearchUrl = '';
}, 100);
};

this.initTabRouting = function(tabs) {
Expand All @@ -103,7 +109,6 @@
$rootScope.$on('$locationChangeSuccess', updateTabs);
};

var that = this;

/**
* Keep history and state of routing for to keep the search state.
Expand Down

0 comments on commit 151ab05

Please sign in to comment.