How to access the elements of the $ ionicModal object by identifier in the ionic structure?

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.

  /*SignaturePad*/
    $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();
  };
  //Cleanup the modal when we're done with it!
  $scope.$on('$destroy', function() {
    $scope.modal.remove();
  });
  // Execute action on hide modal
  $scope.$on('modal.hidden', function() {
    // Execute action
  });
  // Execute action on remove modal
  $scope.$on('modal.removed', function() {
    // Execute action
  });
  $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.

+1
1

, jQuery lite . , ID :

, :

 var canvas=angular.element("#signature-pad");

:

 var canvas=angular.element(document.getElementById("signature-pad"));
+4

All Articles