|
1 |
| -/*! |
| 1 | +/*! |
2 | 2 | * angular-advanced-searchbox
|
3 | 3 | * https://github.com/dnauck/angular-advanced-searchbox
|
4 | 4 | * Copyright (c) 2015 Nauck IT KG http://www.nauck-it.de/
|
@@ -62,12 +62,13 @@ angular.module('angular-advanced-searchbox', [])
|
62 | 62 | });
|
63 | 63 |
|
64 | 64 | // delete not existing search parameters from internal state array
|
65 |
| - angular.forEach($scope.searchParams, function (value, key){ |
| 65 | + for (var i = $scope.searchParams.length - 1; i >= 0; i--) { |
| 66 | + var value = $scope.searchParams[i]; |
66 | 67 | if (!$scope.model.hasOwnProperty(value.key)){
|
67 | 68 | var index = $scope.searchParams.map(function(e) { return e.key; }).indexOf(value.key);
|
68 | 69 | $scope.removeSearchParam(index);
|
69 | 70 | }
|
70 |
| - }); |
| 71 | + } |
71 | 72 | }, true);
|
72 | 73 |
|
73 | 74 | $scope.searchParamValueChanged = function (param) {
|
@@ -127,7 +128,7 @@ angular.module('angular-advanced-searchbox', [])
|
127 | 128 | if (!$scope.isUnsedParameter(searchParam))
|
128 | 129 | return;
|
129 | 130 |
|
130 |
| - var newIndex = |
| 131 | + var newIndex = |
131 | 132 | $scope.searchParams.push(
|
132 | 133 | {
|
133 | 134 | key: searchParam.key,
|
@@ -163,7 +164,7 @@ angular.module('angular-advanced-searchbox', [])
|
163 | 164 | $scope.removeAll = function() {
|
164 | 165 | $scope.searchParams.length = 0;
|
165 | 166 | $scope.searchQuery = '';
|
166 |
| - |
| 167 | + |
167 | 168 | $scope.model = {};
|
168 | 169 |
|
169 | 170 | $scope.$emit('advanced-searchbox:removedAllSearchParam');
|
@@ -292,7 +293,7 @@ angular.module('angular-advanced-searchbox', [])
|
292 | 293 | selection.moveStart('character', -input.value.length);
|
293 | 294 | return selection.text.length - selectionLength;
|
294 | 295 | }
|
295 |
| - } catch(err) { |
| 296 | + } catch(err) { |
296 | 297 | // selectionStart is not supported by HTML 5 input type, so jut ignore it
|
297 | 298 | }
|
298 | 299 |
|
@@ -333,7 +334,7 @@ angular.module('angular-advanced-searchbox', [])
|
333 | 334 | },
|
334 | 335 | link: function($scope, $element, $attrs) {
|
335 | 336 | var supportedInputTypes = ['text', 'search', 'tel', 'url', 'email', 'password', 'number'];
|
336 |
| - |
| 337 | + |
337 | 338 |
|
338 | 339 | var container = angular.element('<div style="position: fixed; top: -9999px; left: 0px;"></div>');
|
339 | 340 | var shadow = angular.element('<span style="white-space:pre;"></span>');
|
|
0 commit comments