Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Commit 3a3ad19

Browse files
author
Austin McDaniel
committed
moving to select choice
1 parent e25153c commit 3a3ad19

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/select.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -301,13 +301,16 @@
301301

302302
ctrl.setActiveItem = function(item) {
303303
ctrl.activeIndex = ctrl.items.indexOf(item);
304-
ctrl.onHighlightCallback($scope, {
305-
$item: item
306-
});
307304
};
308305

309306
ctrl.isActive = function(itemScope) {
310-
return ctrl.open && ctrl.items.indexOf(itemScope[ctrl.itemProperty]) === ctrl.activeIndex;
307+
var isActive = ctrl.open && ctrl.items.indexOf(itemScope[ctrl.itemProperty]) === ctrl.activeIndex;
308+
309+
if (isActive && !angular.isUndefined(ctrl.onHighlightCallback)) {
310+
itemScope.$eval(ctrl.onHighlightCallback);
311+
}
312+
313+
return isActive;
311314
};
312315

313316
ctrl.isDisabled = function(itemScope) {
@@ -608,7 +611,6 @@
608611

609612
$select.onSelectCallback = $parse(attrs.onSelect);
610613
$select.onRemoveCallback = $parse(attrs.onRemove);
611-
$select.onHighlightCallback = $parse(attrs.onHighlight);
612614

613615
//From view --> model
614616
ngModel.$parsers.unshift(function (inputValue) {
@@ -876,6 +878,7 @@
876878
$select.parseRepeatAttr(attrs.repeat, groupByExp); //Result ready at $select.parserResult
877879

878880
$select.disableChoiceExpression = attrs.uiDisableChoice;
881+
$select.onHighlightCallback = attrs.onHighlight;
879882

880883
if(groupByExp) {
881884
var groups = element.querySelectorAll('.ui-select-choices-group');

0 commit comments

Comments
 (0)