ngx-sign-pad is an Angular wrapper for szimek/signature_pad.
npm install ngx-sign-pad --save
import { SignPadModule } from 'ngx-sign-pad';
...
@NgModule({
declarations: [ ],
imports: [ SignPadModule ],
providers: [ ],
bootstrap: [ AppComponent ]
})
import { Component, ViewChild } from '@angular/core';
import { EImageType, SignPadComponent } from 'ngx-sign-pad';
@Component({
template: '<ngx-sign-pad [(signature)]="signature" [type]="imageTypes.SVG"></ngx-sign-pad>'
})
export class AppComponent{
imageTypes = EImageType;
signature = null;
@ViewChild(SignPadComponent) signaturePad: SignPadComponent;
constructor() {
}
clear() {
this.signaturePad.clear();
}
}