I posted the same question in a different way here SiganaturePad . Now I have no idea to handle this. I am using $ ionicModal to populate the SignaturePad with a canvas, as shown below.
$ionicModal.fromTemplateUrl('templates/signature.html', {
scope: $scope,
animation: 'slide-in-up'
}).then(function(modal) {
$scope.modal = modal;
alert('sign 1');
var canvas=angular.element("#signature-pad");
siganturePad = new SignaturePad(canvas);
alert('sign');
signaturePad.minWidth = 5;
signaturePad.maxWidth = 10;
signaturePad.penColor = "rgb(66, 133, 244)";
});
$scope.openModal = function() {
$scope.modal.show();
};
$scope.closeModal = function() {
$scope.modal.hide();
};
$scope.$on('$destroy', function() {
$scope.modal.remove();
});
$scope.$on('modal.hidden', function() {
});
$scope.$on('modal.removed', function() {
});
$timeout($scope.openModal, 200);
But I get an error like " Error: [jqLite: nosel] Finding items using selectors is not supported by jqLite! See: http://docs.angularjs.org/api/angular.element "
I can predict the problem. I am accessing elements using id incorrectly. So you could suggest how to access SiganaturePad for initialization and access to its elements (clean and save) in $ ionicModal.