Reputation: 942
I want disabled button in Angular when my user does click in save ->
HTML ->
<form #myForm="ngForm" (ngSubmit)="save(myForm)">
<button class="btn btn-sm btn-success" [disabled]="myForm.form.pristine">Save</button>
.ts
save(myForm: NgForm) {
myForm.form.pristine;
}
Then if my User does change in my form I need activated my button.
Error->
{
"message": "unused expression, expected an assignment or function call (no-
Upvotes: 1
Views: 176
Reputation: 610
What are you mean by [disabled]="myForm.form.pristine"
? @Input() disabled: boolean //Whether the component is disabled.
<form #myForm="ngForm" (ngSubmit)="save(myForm)">
<button class="btn btn-sm btn-success" [disabled]="isDisbled">Save</button>
Upvotes: 1