使用AngularJS进行数字签名

时间:2014-09-12 16:55:28

标签: angularjs digital-signature

我正在使用MEAN堆栈,我想为具有表单的员工实现数字签名,但我找不到关于此主题的任何库或教程。

有人这样做过吗?这样做的正确方法是什么?

2 个答案:

答案 0 :(得分:5)

查看ngSignaturePad。它使用SignaturePad jQuery插件。

https://github.com/ecentinela/ng-signature-pad

答案 1 :(得分:4)

感谢vonwolf的问题!我发现另一个解决方案检查:

https://github.com/legalthings/angular-signature

但是,我尝试使用上面的例子来实现一个简单的例子,但是我在控制台中看到了我无法解决的错误。我做了相同的ng-signature-pad,它工作正常,没有任何错误。

Simple example using angular-signature Control

<!DOCTYPE html>
<html>

<head>
  <title>Sample angular-singature</title>
  <link rel="stylesheet" href="style.css">
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.8/angular.min.js"></script>
  <script src="https://cdn.rawgit.com/legalthings/angular-signature/master/src/signature.js"></script>
  <script src="https://cdn.rawgit.com/szimek/signature_pad/master/signature_pad.js"></script>
  <style>
    .nowrap {
      white-space:pre-wrap;
      word-wrap:break-word;
    }
  </style>
</head>

<body ng-app='app' ng-controller='SignModalCtrl'>
  <h1>Angular Signature Sample</h1>
  <signature-pad accept="accept" clear="clear" height="220" width="568"></signature-pad>
  <button ng-click="clear()">Clear signature</button>
  <button ng-click="doAccept()">Sign</button>
  <pre class='nowrap' ng-bind="accept().dataUrl"></pre>
  <script>
    var app = angular.module('app', [
      'signature',
    ]);
    app.controller('SignModalCtrl', [
      '$scope',
      function($scope) {
        $scope.doAccept = function () {
          var signature = $scope.accept();
          console.log('doAccpet', signature)
        }
        $scope.done = function() {
          var signature = $scope.accept();

          if (signature.isEmpty) {
            $modalInstance.dismiss();
          } else {
            $modalInstance.close(signature.dataUrl);
          }
        };
      }
    ]);
  </script>
</body>

</html>  

And, here is the other simple example using ng-signature-pad

此外,您还可以找到其他解决方案:

https://www.sitepoint.com/4-jquery-digital-signature-plugins/

塔雷克