Skip to content

Commit 71ec51f

Browse files
felizbearbzz
authored andcommitted
clear search field on navigation to home view (/)
1 parent 1e1357c commit 71ec51f

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

zeppelin-web/src/components/navbar/navbar.controller.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
/*
2-
* Licensed under the Apache License, Version 2.0 (the "License");
2+
* Licensed under the Apache License, Version 2.0 (the 'License');
33
* you may not use this file except in compliance with the License.
44
* You may obtain a copy of the License at
55
*
66
* http://www.apache.org/licenses/LICENSE-2.0
77
*
88
* Unless required by applicable law or agreed to in writing, software
9-
* distributed under the License is distributed on an "AS IS" BASIS,
9+
* distributed under the License is distributed on an 'AS IS' BASIS,
1010
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1111
* See the License for the specific language governing permissions and
1212
* limitations under the License.
@@ -34,6 +34,17 @@ angular.module('zeppelinWebApp').controller('NavCtrl', function($scope, $rootSco
3434
vm.connected = param;
3535
});
3636

37+
$rootScope.$on('$locationChangeSuccess', function () {
38+
var path = $location.path();
39+
// felizbear:
40+
// this is a somewhat hacky solution to clear search bar,
41+
// as I couldn't figure out how to make ng-click work in navbar
42+
// on the other hand, what is not hacky in current zeppelin-web ;)
43+
if (path === '/') {
44+
$scope.searchTerm = '';
45+
}
46+
});
47+
3748
$scope.search = function() {
3849
$location.url(/search/ + $scope.searchTerm);
3950
};

0 commit comments

Comments
 (0)