fengxiang
2018-07-11 12b04f145bae740e1971036b1e2dfc1bc224d17b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { Component, OnInit } from '@angular/core';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import { TransferService } from './transfer.service';
 
@Component({
  selector: 'app-step2',
  templateUrl: './step2.component.html',
})
export class Step2Component implements OnInit {
  form: FormGroup;
  loading = false;
 
  constructor(private fb: FormBuilder, public item: TransferService) {}
 
  ngOnInit() {
    this.form = this.fb.group({
      password: [
        null,
        Validators.compose([Validators.required, Validators.minLength(6)]),
      ],
    });
    this.form.patchValue(this.item);
  }
 
  //#region get form fields
  get password() {
    return this.form.controls.password;
  }
  //#endregion
 
  _submitForm() {
    this.loading = true;
    setTimeout(() => {
      this.loading = false;
      ++this.item.step;
    }, 1000 * 2);
  }
 
  prev() {
    --this.item.step;
  }
}