我正在使用Angular2-签名垫。
我在试着验证签名垫。像这样
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();
}
}这是我的savepad()函数。
我想要这种功能:
如果签名簿是空的(除非没有签名),那么祝酒词就会出现“您必须先签名”。否则它将成功保存。
这能验证angular2-signaturepad吗?
或
我做错什么了吗?
如果可能的话,请引导我!
发布于 2018-10-11 11:07:14
您可以使用isEmpty()检查签名垫是否为空。
使用
this.signaturePad.isEmpty()
这将返回真假。
希望这能帮上忙。
https://stackoverflow.com/questions/45078614
复制相似问题