src/app/core/common-components/error-hint/error-hint.component.ts
selector | app-error-hint |
imports |
NgForOf
KeyValuePipe
|
styleUrls | ./error-hint.component.scss |
templateUrl | ./error-hint.component.html |
Inputs |
form | |
Type : UntypedFormControl
|
|
import { Component, Input } from "@angular/core";
import { UntypedFormControl } from "@angular/forms";
import { KeyValuePipe, NgForOf } from "@angular/common";
@Component({
selector: "app-error-hint",
templateUrl: "./error-hint.component.html",
styleUrls: ["./error-hint.component.scss"],
imports: [NgForOf, KeyValuePipe],
})
export class ErrorHintComponent {
@Input() form: UntypedFormControl;
}
<div *ngFor="let err of form?.errors | keyvalue">
{{ err.value["errorMessage"] }}
<ng-content></ng-content>
</div>
./error-hint.component.scss
:host {
position: absolute;
}