blob: da642cb869578bb2b18c1223a98b7a054aa8a915 (
plain)
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
|
import { Component, Output, OnInit, EventEmitter, Input } from '@angular/core';
import { FormGroup, FormControl } from '@angular/forms';
export type LoginMessage = 'nologin' | 'invalidlogin' | string;
export class LoginEvent {
username: string;
password: string;
}
@Component({
selector: 'app-user-login',
templateUrl: './user-login.component.html',
styleUrls: ['./user-login.component.css']
})
export class UserLoginComponent {
@Input()
message: LoginMessage;
@Output()
login = new EventEmitter<LoginEvent>();
form = new FormGroup({
username: new FormControl(''),
password: new FormControl('')
});
onLoginButtonClick() {
this.login.emit(this.form.value);
}
}
|