Giter Site home page Giter Site logo

Comments (10)

sovanyio avatar sovanyio commented on July 29, 2024

Removing the inputs: ['options'] in the component declarations makes this work for me through npm

from angular2-signaturepad.

lathonez avatar lathonez commented on July 29, 2024

@sovanyio could you share the relevant code you used to invoke the signature pad please?

Ours looks like this:

controller

// snip
@Component({
  templateUrl: 'build/checkin/signaturePad/signaturePad.html',
  directives: [Button, SignaturePad]
})
// snip
  public signaturePadOptions: Object = {
    canvasWidth: 800,
    canvasHeight: 500
  };
// snip
  public doOnEnd(): void {
    this.valid = !this.signaturePad.isEmpty();
  }

template

<!-- snip -->
 <signature-pad [options]="signaturePadOptions" (onEndEvent)="doOnEnd()"></signature-pad>

from angular2-signaturepad.

sovanyio avatar sovanyio commented on July 29, 2024

controller

import { Component, ViewChild, forwardRef } from '@angular/core';
import { SignaturePad } from 'angular2-signaturepad';
import { NG_VALUE_ACCESSOR, REACTIVE_FORM_DIRECTIVES } from '@angular/forms';

/*
  Generated class for the SignatureField component.

  See https://angular.io/docs/ts/latest/api/core/ComponentMetadata-class.html
  for more info on Angular 2 Components.
*/
@Component({
  selector: 'signature-field',
  templateUrl: 'build/components/signature-field/signature-field.html',
  directives: [
    REACTIVE_FORM_DIRECTIVES,
    SignaturePad
  ],
  providers: [
    {
      provide: NG_VALUE_ACCESSOR,
      useExisting: forwardRef(() => SignatureField),
      multi: true
    }
  ]
})
export class SignatureField {
  @ViewChild(SignaturePad) signaturePad: SignaturePad;

  options: Object = {};

  _signature: any = null;

  propagateChange = (_: any) => {};

  get signature() {
    return this._signature;
  }

  set signature(value) {
    this._signature = value;
    this.propagateChange(this.signature);
  }

  writeValue(value: any) {
    this.signaturePad.fromDataURL(value);
  }

  registerOnChange(fn: any) {
    this.propagateChange = fn;
  }

  registerOnTouched() {}

  ngAfterViewInit() {
    this.signaturePad.clear();
  }

  drawComplete() {
    this.signature = this.signaturePad.toDataURL();
  }
}

template

<signature-pad [options]="options" (onEndEvent)="drawComplete()"></signature-pad>

from angular2-signaturepad.

lathonez avatar lathonez commented on July 29, 2024

Thanks a lot, will give it a whirl this coming week and see if I can replicate what you're seeing.

Off topic, what are you using to generate the controller class definition?

from angular2-signaturepad.

sovanyio avatar sovanyio commented on July 29, 2024

The ionic2 cli

from angular2-signaturepad.

lathonez avatar lathonez commented on July 29, 2024

Sorry for the delayed response, I've been pretty busy with work this week.

I've done my best to implement your changes verbatim to my demo project, and cannot replicate the issue you've reported.

https://github.com/lathonez/clicker/compare/signaturepad-7?expand=1

Can you replicate the error on this branch? Your signature-field component is on a form in the second page ("Goodbye Ionic").

from angular2-signaturepad.

sovanyio avatar sovanyio commented on July 29, 2024

Ah I feel silly, I was super behind somehow on 1.0.4. Not sure how that happened. Anyway, closing. Thanks!

from angular2-signaturepad.

pradeepranasinghe avatar pradeepranasinghe commented on July 29, 2024

hi all,

could you please provide an example for 2 signature-pad instances setting different values from different data URLs?

Thanks!

from angular2-signaturepad.

lathonez avatar lathonez commented on July 29, 2024

@pradeepranasinghe

You are very unlikely to get helpful responses from anyone by posting on closed issues.

from angular2-signaturepad.

pradeepranasinghe avatar pradeepranasinghe commented on July 29, 2024

Sorry! BTW thanks for your reply!

from angular2-signaturepad.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.