angular-hotkeys
angular-hotkeys copied to clipboard
In callback function array is not visible from scope
Hi,
when you run $scope.AddItem function for example 3 times and call function $scope.Test you will see that the size of $scope.items is equal 3. But when you click 'del' you will see that $scope.items size is 0.
Why ?
hotkeys.bindTo($scope)
.add({
combo: 'del',
description: 'blah blah',
callback: function () {
$scope.Test();
}
})
$scope.Test = function()
{
alert($scope.items.length);
}
$scope.AddItem = function()
{
$scope.items.push({ test: 'Test' });
}
Works fine for me: https://plnkr.co/MtiI5X
The link does not work. Can you send working example ?
Hmm yeah it seems to have trouble loading, but if you click the "Launch in Editor" button you can see the code and run it.