I am trying to implement angular2 signature pad in my ionic 3 project i am getting error as above my question. I am following this tutorial link. It is working fine in ionic2 but when i try in ionic 3 i am getting error like below
Failed to navigate: Template parse errors:
Can't bind to 'options' since it isn't a known property of 'signature-pad'.
1. If 'signature-pad' is an Angular component and it has 'options' input, then verify that it is part of this module.
2. If 'signature-pad' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. ("
<ion-col></ion-col>
<ion-col>
<signature-pad [ERROR ->][options]="signaturePadOptions" (onBeginEvent)="drawStart()" (onEndEvent)="drawComplete()"></signatur"): ng:///ConformsignModule/Conformsign.html@20:21
'signature-pad' is not a known element:
1. If 'signature-pad' is an Angular component, then verify that it is part of this module.
2. If 'signature-pad' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message. ("
<ion-col></ion-col>
<ion-col>
[ERROR ->]<signature-pad [options]="signaturePadOptions" (onBeginEvent)="drawStart()" (onEndEvent)="drawComplet"): ng:///ConformsignModule/Conformsign.html@20:6
you can get the full code in this like i just trying everything in this https://devdactic.com/signature-drawpad-ionic-2/
I think when i use deeplink navigation i am getting this error but when i import my component to app.module.ts everything is working fine
update
here is my .ts file
export class Conformsign {
signature = '';
isDrawing = false;
finalData
@ViewChild(SignaturePad) signaturePad: SignaturePad;
@Input()
private signaturePadOptions: Object = { // Check out https://github.com/szimek/signature_pad
'minWidth': 2,
'canvasWidth': 400,
'canvasHeight': 200,
'backgroundColor': '#f6fbff',
'penColor': '#666a73'
};
constructor(public navCtrl: NavController, public navParams: NavParams, public toastCtrl: ToastController, public holders: Holders, public rest:Rest) {
this.finalData = this.holders.getData();
}
ionViewDidLoad() {
console.log('ionViewDidLoad Conformsign');
}
ionViewDidEnter() {
this.signaturePad.clear()
}
drawComplete() {
this.isDrawing = false;
}
drawStart() {
this.isDrawing = true;
}
savePad() {
this.signature = this.signaturePad.toDataURL();
this.signaturePad.clear();
let toast = this.toastCtrl.create({
message: 'New Signature saved.',
duration: 3000
});
toast.present();
let conformDelivery = {
order_id: this.finalData.order_id,
amountpaid:this.finalData.total,
customername:this.finalData.firstname,
signature:this.signature,
user_id:this.finalData.user_id,
customer_id:this.finalData.customer_id
}
}
clearPad() {
this.signaturePad.clear();
}
}
here is my .html
<ion-content>
<div class="title">Please draw your Signature</div>
<ion-row [ngClass]="{'drawing-active': isDrawing}">
<ion-col></ion-col>
<ion-col>
<signature-pad [options]="signaturePadOptions" (onBeginEvent)="drawStart()" (onEndEvent)="drawComplete()"></signature-pad>
</ion-col>
<ion-col></ion-col>
</ion-row>
<button ion-button full color="danger" (click)="clearPad()">Clear</button>
<button ion-button full color="secondary" (click)="savePad()">Save</button>
<ion-row>
<ion-col></ion-col>
<ion-col width-80>
<img [src]="signature"/>
</ion-col>
<ion-col></ion-col>
</ion-row>
</ion-content>
I was facing this issue also. I solved this issue by going through comments on the original post by devdactic https://devdactic.com/signature-drawpad-ionic-2/
A guy named Ka mok pointed me to something
IF you are using the signature pad in a component . in my case am using it in a farmers component, the component usually have a farmer.module.ts file. So just import the signature pad module and everything should work fine
e.g
farmer.module.ts
import { NgModule } from '@angular/core';
import { IonicPageModule } from 'ionic-angular';
import { FarmerPage } from './farmer';
import { SignaturePadModule } from 'angular2-signaturepad';
@NgModule({
declarations: [
FarmerPage,
],
imports: [
IonicPageModule.forChild(FarmerPage),
SignaturePadModule // this saved my life
],
})
export class FarmerPageModule {}
farmer.ts
import { Component, ViewChild } from '@angular/core';
import { IonicPage, NavController, NavParams } from 'ionic-angular';
import { SignaturePad } from 'angular2-signaturepad/signature-pad';
import { NativeStorage } from '@ionic-native/native-storage';
import { ToastController } from 'ionic-angular';
Lastly make sure you also import the module in app.module.ts
I hope this helps someone. Thanks
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With