import { Component, OnInit,ViewChild  } from '@angular/core';
import { MyService } from '../../my.service';
import { ActivatedRoute,Router } from "@angular/router";
import { LifeCommonService } from "../../../common/life-common.service";
import {SignaturePad} from 'angular2-signaturepad'
import EleSign from "elesigncode";
import * as $ from 'jquery';
@Component({
  selector: 'ydlife-signature',
  templateUrl: './signature.component.html',
  styleUrls: ['./signature.component.scss']
})
export class SignatureComponent implements OnInit {
  signatureImage:string;
  @ViewChild(SignaturePad) signaturePad: SignaturePad;
  constructor(private activatedRoute: ActivatedRoute,
    private router: Router,public lifeCommonService:LifeCommonService,
    public myService:MyService) { 
      
    }

  ngOnInit() {
    const title = this.activatedRoute.snapshot.data[0]['title'];
    this.lifeCommonService.setTitle(title);
    var ele = document.getElementById("signature");
    var eleSign = new EleSign();//实例化对象
    eleSign.init({setBgColor:'#333333'}); //初始化
    eleSign.moutedEle(ele) //将签名节点放入到传入的element节点中
  }

  next(){
    this.router.navigate(['/employee_submit']);
  }
}
