-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentry.component.ts
57 lines (57 loc) · 1.4 KB
/
entry.component.ts
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import { CommonModule } from '@angular/common';
import { Component } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { UserService } from '@angular-mf/data-access-user';
@Component({
selector: 'angular-mf-login-entry',
standalone: true,
imports: [
CommonModule,
FormsModule,
],
template: `
<div class="login-app">
<form class="login-form" (ngSubmit)="login()">
<label>
Username:
<input type="text" name="username" [(ngModel)]="username" />
</label>
<label>
Password:
<input type="password" name="password" [(ngModel)]="password" />
</label>
<button type="submit">Login</button>
</form>
<div *ngIf="isLoggedIn$ | async">User is logged in!</div>
</div>
`,
styles: [
`
.login-app {
width: 30vw;
border: 2px dashed black;
padding: 8px;
margin: 0 auto;
}
.login-form {
display: flex;
align-items: center;
flex-direction: column;
margin: 0 auto;
padding: 8px;
}
label {
display: block;
}
`,
],
})
export class RemoteEntryComponent {
username = '';
password = '';
isLoggedIn$ = this.userService.isUserLoggedIn$;
constructor(private userService: UserService) {}
login() {
this.userService.checkCredentials(this.username, this.password);
}
}