Skip to content

Commit e656d9d

Browse files
committed
refactor(search): search box clears on page change
1 parent a244e21 commit e656d9d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

app/scripts/services/sitesearchservice.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,24 @@
88
* Factory in the orphaApp.
99
*/
1010
angular.module('orphaApp')
11-
.factory('siteSearchService', function(searchService, $state, $log) {
11+
.factory('siteSearchService', function(searchService, $state, $log, $rootScope) {
1212
var service = {
1313
query: '',
1414
getResults: getResults,
1515
changed: changed
1616
};
17+
$rootScope.$on('$stateChangeSuccess',
18+
function(event, toState, toParams, fromState, fromParams) {
19+
service.query = '';
20+
}
21+
);
1722
return service;
1823

19-
2024
function getResults(query) {
2125
return searchService.search(query);
2226
}
2327

2428
function changed($item, $model, $label) {
25-
$log.debug('got changed!', $item, $model, $label);
2629
var params = {};
2730
var type = $item.type.toLowerCase();
2831
if (type === 'clinical sign') {

0 commit comments

Comments
 (0)