I don't have expert knowledge in Angular and I would need some help. I want to validate a form which is placed in component called "viewForm". The form is generated by a loop of a object array called "points". At the end of the "viewForm" I include another component called "footer" which has 4 buttons that in turn calls different services to update values etc.
Now I want to add some validation to the inputs in the form(required) but the issue is that my buttons aren't in the same component as the form. How could that be solved? I've seen examples on how to do this with submit buttons or where buttons are in the same component but in my case it's different. I guess I need to add validation to the form and then pass it on to the "footer" component somehow to be able to validate the form before deciding whether to call the service or not.
Here's a short cut of "viewForm":
<div> <div *ngFor="let point of points; let x = index"> <mat-form-field class="example-full-width"> <input matInput type="text" [(ngModel)]="point.cValue" Placeholder=""> </mat-form-field> </div> </div> <app-footer></app-footer> The footer component looks like this:
<footer class="footer"> <div class="button-row"> <button mat-raised-button (click)="save($event)">Save</button> <button mat-raised-button (click)="send($event)">Send</button> <button mat-raised-button (click)="noDeal($event)">No Deal</button> <button mat-raised-button (click)="deal($event)">Deal</button> </div> </footer>