import { Router } from '@angular/router';
|
import { Component } from '@angular/core';
|
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
|
import { SettingsService } from '@delon/theme';
|
|
@Component({
|
selector: 'passport-lock',
|
templateUrl: './lock.component.html',
|
})
|
export class UserLockComponent {
|
f: FormGroup;
|
|
constructor(
|
public settings: SettingsService,
|
fb: FormBuilder,
|
private router: Router,
|
) {
|
this.f = fb.group({
|
password: [null, Validators.required],
|
});
|
}
|
|
submit() {
|
// tslint:disable-next-line:forin
|
for (const i in this.f.controls) {
|
this.f.controls[i].markAsDirty();
|
this.f.controls[i].updateValueAndValidity();
|
}
|
if (this.f.valid) {
|
console.log('Valid!');
|
console.log(this.f.value);
|
this.router.navigate(['dashboard']);
|
}
|
}
|
}
|