import { Component, Input, Output, EventEmitter } from '@angular/core'; import { FormGroup, FormControl } from '@angular/forms'; import { Credentials } from '@example-app/auth/models'; @Component({ selector: 'bc-login-form', template: ` Login

`, styles: [ ` :host { display: flex; justify-content: center; margin: 4.5rem 0; } .mat-mdc-form-field { width: 100%; min-width: 300px; } mat-card-title { text-align: center; margin: 1rem 0; } mat-card-content { justify-content: center; } .login-error { padding: 1rem; width: 300px; color: white; background-color: red; } .login-buttons { display: flex; flex-direction: row; justify-content: flex-end; } `, ], standalone: false, }) export class LoginFormComponent { @Input() set pending(isPending: boolean) { if (isPending) { this.form.disable(); } else { this.form.enable(); } } @Input() errorMessage!: string | null; @Output() submitted = new EventEmitter(); form: FormGroup = new FormGroup({ username: new FormControl('ngrx'), password: new FormControl(''), }); submit() { if (this.form.valid) { this.submitted.emit(this.form.value); } } }