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

feat(timepicker): have up/down arrow keys control time selection #3068

Closed
wants to merge 4 commits into from

Conversation

joshfriend
Copy link
Contributor

Similar to #2316, but:

  • has tests/docs.
  • properly consumes up/down events with preventDefault.

hoursInputEl.bind('keydown', function(e) {
if ( e.which === 38 ) { // up
$scope.$apply(function() {
$scope.incrementHours();
Copy link
Contributor

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();

@wesleycho wesleycho added this to the 0.14 milestone Mar 23, 2015
@@ -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;
Copy link
Contributor

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.

Copy link
Contributor

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.

@wesleycho
Copy link
Contributor

This LGTM once that change is made back to use $scope.$parent.$eval.

@joshfriend
Copy link
Contributor Author

@wesleycho would you like me to rebase this branch so that 0027763 and 8eb93ce are squashed?

@wesleycho
Copy link
Contributor

That won't be necessary, I can do the rebasing if needed.

@wesleycho
Copy link
Contributor

Landed as 2296115, thanks!

@wesleycho wesleycho closed this Mar 23, 2015
@wesleycho wesleycho modified the milestones: 0.13.0, 0.14 Mar 23, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants