Skip to content

Commit 07fcc1c

Browse files
committed
workaround a small timing issue and enable edit mode explicit on newly added parameters
1 parent 722c89a commit 07fcc1c

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
### 2.0.1 - 14 December 2015
22
* enter and leave edit mode methods and events was not called every time due ng-if directive, fixed #17
3+
* workaround a small timing issue and enable edit mode explicit on newly added parameters
34

45
### 2.0.0 - 11 December 2015
56
* Support to add, delete search parameters and change search parameter's values via ng-model, fixed issue #7, #9 and #10

src/angular-advanced-searchbox.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -120,15 +120,18 @@ angular.module('angular-advanced-searchbox', [])
120120
if (!$scope.isUnsedParameter(searchParam))
121121
return;
122122

123-
$scope.searchParams.push(
124-
{
125-
key: searchParam.key,
126-
name: searchParam.name,
127-
placeholder: searchParam.placeholder,
128-
value: value || '',
129-
editMode: enterEditModel
130-
}
131-
);
123+
var newIndex =
124+
$scope.searchParams.push(
125+
{
126+
key: searchParam.key,
127+
name: searchParam.name,
128+
placeholder: searchParam.placeholder,
129+
value: value || ''
130+
}
131+
) - 1;
132+
133+
if (enterEditModel === true)
134+
$timeout(function() { $scope.enterEditMode(undefined, newIndex); }, 100);
132135

133136
updateModel('add', searchParam.key, value);
134137
};

0 commit comments

Comments
 (0)