added login component
This commit is contained in:
36
src/app/account/login/login.component.ts
Normal file
36
src/app/account/login/login.component.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { FormControl, FormGroup } from '@angular/forms';
|
||||
import { AccountService } from '../account.service';
|
||||
import {ActivatedRoute, Router} from '@angular/router';
|
||||
|
||||
@Component({
|
||||
selector: 'app-login',
|
||||
templateUrl: './login.component.html',
|
||||
styleUrls: ['./login.component.css']
|
||||
})
|
||||
export class LoginComponent implements OnInit {
|
||||
form: FormGroup = new FormGroup({
|
||||
username: new FormControl(''),
|
||||
password: new FormControl(''),
|
||||
});
|
||||
loading = false;
|
||||
returnUrl = this.activatedRoute.snapshot.queryParams['returnUrl'] || '/';
|
||||
|
||||
onLogin() {
|
||||
this.loading = true;
|
||||
if (this.form.invalid) {
|
||||
return;
|
||||
}
|
||||
console.log(this.form.value);
|
||||
|
||||
}
|
||||
|
||||
constructor(private accountService: AccountService,
|
||||
private activatedRoute: ActivatedRoute,
|
||||
private router: Router,
|
||||
) { }
|
||||
|
||||
ngOnInit(): void {
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user