Skip to content

Commit

Permalink
call keyboard destroy function on $scope destroy
Browse files Browse the repository at this point in the history
call keyboard destroy function on $scope destroy to clean and remove all listeners on the page that can cause memory leak and grow up without any control during page usage.
  • Loading branch information
CrazYoshi authored Sep 28, 2017
1 parent fb6052e commit 037835d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/ng-virtual-keyboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@ angular.module('ng-virtual-keyboard', [])
ngModelCtrl.$setViewValue(elements[0].value);
});
});
scope.$on("$destroy", function() {
$(elements[0]).keyboard().getkeyboard().destroy();
});
}
};
}
Expand Down

0 comments on commit 037835d

Please sign in to comment.