-
Notifications
You must be signed in to change notification settings - Fork 6.7k
feat(timepicker): have up/down arrow keys control time selection #3068
Conversation
hoursInputEl.bind('keydown', function(e) { | ||
if ( e.which === 38 ) { // up | ||
$scope.$apply(function() { | ||
$scope.incrementHours(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be rewritten as
$scope.incrementHours(); $scope.$apply();
@@ -26,6 +27,11 @@ angular.module('ui.bootstrap.timepicker', []) | |||
this.setupMousewheelEvents( hoursInputEl, minutesInputEl ); | |||
} | |||
|
|||
var arrowkeys = angular.isDefined($attrs.arrowkeys) ? $scope.$eval($attrs.arrowkeys) : timepickerConfig.arrowkeys; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I meant modify the directive scope to set arrowkeys: '=?'
. It should be present by the time the init function is run, so you can directly pull the value from $scope.arrowkeys
in that case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually upon looking at the rest of the source, change this back to $scope.$parent.$eval - I would rather have consistency with the rest of the source for now.
This LGTM once that change is made back to use $scope.$parent.$eval. |
…ope" This reverts commit 0027763.
@wesleycho would you like me to rebase this branch so that 0027763 and 8eb93ce are squashed? |
That won't be necessary, I can do the rebasing if needed. |
Landed as 2296115, thanks! |
Similar to #2316, but:
preventDefault
.