I need to write a component that can be used in a form. I want to publish it as ng-invalid for the form.
that is my form template/view:
<form #myForm="ngForm">
<domain-base-value [(ngModel)]="value.value" name="bla" #bla="ngModel">
</domain-base-value>
<div [hidden]="myForm.valid || myForm.pristine">
Form is not valid
</div>
</form>
that is domain-base-value component view:
<input [(ngModel)]="value" required />
if I run it, the input get ng-invalid but not the domain-base-value and the form.
I can move the required
to the form, but I want that the child component will have the logic when is it valid and when not.
any suggestions?