Skip to content

Commit

Permalink
Update umb-mini-search component (#8566)
Browse files Browse the repository at this point in the history
  • Loading branch information
bjarnef authored Aug 31, 2020
1 parent 6f5806c commit 6ff100a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
angular
.module('umbraco')
.component('umbMiniSearch', {
templateUrl: 'views/components/umb-mini-search/umb-mini-search.html',
templateUrl: 'views/components/umb-mini-search.html',
controller: UmbMiniSearchController,
controllerAs: 'vm',
bindings: {
Expand All @@ -18,6 +18,9 @@
function UmbMiniSearchController($scope) {

var vm = this;

vm.onKeyDown = onKeyDown;
vm.onChange = onChange;

var searchDelay = _.debounce(function () {
$scope.$apply(function () {
Expand All @@ -27,23 +30,23 @@
});
}, 500);

vm.onKeyDown = function (ev) {
function onKeyDown(evt) {
//13: enter
switch (ev.keyCode) {
switch (evt.keyCode) {
case 13:
if (vm.onSearch) {
vm.onSearch();
}
break;
}
};
}

vm.onChange = function () {
function onChange() {
if (vm.onStartTyping) {
vm.onStartTyping();
}
searchDelay();
};
}

}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<ng-form class="umb-mini-search" ng-class="{'--has-value': vm.model !== null && vm.model !== ''}" novalidate>
<i class="icon icon-search" aria-hidden="true"></i>
<input type="text"
class="form-control search-input"
localize="placeholder,label"
label="@general_typeToSearch"
placeholder="@general_typeToSearch"
ng-model="vm.model"
ng-change="vm.onChange()"
ng-keydown="vm.onKeyDown($event)"
ng-blur="vm.onBlur($event)"
prevent-enter-submit
no-dirty-check>
</ng-form>

This file was deleted.

0 comments on commit 6ff100a

Please sign in to comment.