From 1a30ba4211462589698d26688ec24319e48b740c Mon Sep 17 00:00:00 2001 From: fengxiang <110431245@qq.com> Date: Wed, 11 Jul 2018 15:08:40 +0800 Subject: [PATCH] 提交 --- src/app/routes/passport/lock/lock.component.ts | 35 +++++++++++++++++++++++++++++++++++ 1 files changed, 35 insertions(+), 0 deletions(-) diff --git a/src/app/routes/passport/lock/lock.component.ts b/src/app/routes/passport/lock/lock.component.ts new file mode 100644 index 0000000..1da2f35 --- /dev/null +++ b/src/app/routes/passport/lock/lock.component.ts @@ -0,0 +1,35 @@ +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']); + } + } +} -- Gitblit v1.8.0