angular-hotkeys
angular-hotkeys copied to clipboard
bindTo equivalent for component controller?
Hi folks,
I recently upgraded my app to Angular 1.5.8 and am gradually converting my controllers and directives to components. In my directives I was doing:
hotkeys.bindTo(scope)
.add(
{
combo: 'p f',
description: 'Create a forecast for a project',
callback: function () {
vm.openGroup = true;
vm.edit();
}
}
)
This no longer works with a component's controller. For now I'm just going to use the $onDestroy lifecycle hook to remove the hotkeys, but this will get tedious, especially on pages with lots and lots of hotkeys. Thoughts?
P.S. It also looks like chaining adds no longer works, unless I'm missing something.
Thanks so much, this is a great directive!
I am in the same boat. I will try to use the route hotkeys, if that doesnt work I must look for another package I guess.
@samjulien can you tell me why this doesn't work?