1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-25 12:43:36 +00:00
Files
browser/apps/web/src/app/tools/send/send-access-password.component.ts
Oscar Hinton c50a9063bc [PM-2340] Enable use-lifecycle-interface (#5488)
Enables one of the recommended rules of @angular-eslint. Since this rule was fairly trivial to fix and has no QA effects it seemed reasonable to migrate all code.
2024-08-02 13:59:38 -04:00

37 lines
1023 B
TypeScript

import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from "@angular/core";
import { FormBuilder, Validators } from "@angular/forms";
import { Subject, takeUntil } from "rxjs";
import { SharedModule } from "../../shared";
@Component({
selector: "app-send-access-password",
templateUrl: "send-access-password.component.html",
imports: [SharedModule],
standalone: true,
})
export class SendAccessPasswordComponent implements OnInit, OnDestroy {
private destroy$ = new Subject<void>();
protected formGroup = this.formBuilder.group({
password: ["", [Validators.required]],
});
@Input() loading: boolean;
@Output() setPasswordEvent = new EventEmitter<string>();
constructor(private formBuilder: FormBuilder) {}
async ngOnInit() {
this.formGroup.controls.password.valueChanges
.pipe(takeUntil(this.destroy$))
.subscribe((val) => {
this.setPasswordEvent.emit(val);
});
}
ngOnDestroy() {
this.destroy$.next();
this.destroy$.complete();
}
}