hey for some reason I cannot submit my form can anyone explain why? I'm using Angular Material.
html:
<mat-dialog-content>
<form class="example-form"[formGroup]="movieForm" (ngSubmit)="addMovie(movieForm.value)">
......
<button mat-button type="submit" [disabled]="!movieForm.valid" [mat-dialog-close]="true">Save</button>
<button mat-button [mat-dialog-close]="true">Cancel</button>
</form>
</mat-dialog-content>
and this is the component:
addMovie(form) {
console.log("check");
}
How come I cant see the console.log?
Actually you don't need to pass any parameter because you already have the movieForm references in you component.ts .just do the following:
Template html
<form (ngSubmit)="addMovie()">
Component.ts
addMovie() {
console.log(this.movieForm);
}
To access directly to your values check the console object result structure. You will see all the properties that you can access.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With