Javascript 如何验证angular2 signaturepad?

Javascript 如何验证angular2 signaturepad?,javascript,angular,ionic2,signaturepad,Javascript,Angular,Ionic2,Signaturepad,我正在使用 我正在尝试验证签名板。 像这样 savePad() { this.signature = this.signaturePad.toDataURL(); if (this.signature != '' && this.signature == undefined) { // this.signature = this.signaturePad.toDataURL(); this.signature =

我正在使用

我正在尝试验证签名板。 像这样

savePad() {
      this.signature = this.signaturePad.toDataURL();
      if (this.signature != '' && this.signature == undefined) {
          //  this.signature = this.signaturePad.toDataURL();
          this.signature = '';
          let toast = this.toastCtrl.create({
              message: 'You have to Signature first.',
              duration: 3000,
              position: 'c'
          });
          toast.present();
      }else{
      this.signaturePad.clear();
          let toast = this.toastCtrl.create({
              message: 'New Signature saved.',
              duration: 3000,
              position: 'top'
          });
          toast.present();
      }
  }
这是我的存储板功能

我想要这种功能:


如果签名板是空的,没有签名,那么吐司要来,你必须先签名。 否则它将成功保存

这是否可以验证angular2 signaturepad

我做错什么了吗

如果可能的话
请引导我

您可以使用isEmpty检查签名板是否为空。 使用:

这个签名是空的

这将返回true/false


希望这能有所帮助。

有什么问题吗?你能更具体地说你想做什么吗?如果签名板是空的,没有签名,那么祝酒人想来,你必须先签名。否则它将成功保存。