New file |
| | |
| | | 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; |
| | | } |
| | | } |