I'm trying to write a directive in angularJS which allow to open this https://github.com/Mottie/Keyboard/ on-screen keyboard on click a button or image. So far I made based on this topic : Update AngularJS models from a jQuery plugin with a "on change" callback, directive which open a keyboard on click at input field. Can anyone help me with it ?
app.directive('keyboard',function(){
return {
require : '?ngModel',
restrict : 'C',
link : function(scope,element,attrs,ngModelCtrl){
if(!ngModelCtrl){
return;
}
$(element).keyboard({
stickyShift: false,
usePreview: false,
autoAccept: true,
change: function(e, kb, el) {
if(!scope.$$phase && !scope.$root.$$phase)
{
scope.$apply(function(){
ngModelCtrl.$setViewValue(el.value);
});
}
}
});
}
};
});