Angular Material - show mat-error on button click

后端 未结 10 1925
刺人心
刺人心 2021-02-02 07:48

I am trying to do validation using the and . This works fine when user tabs out of the input without filling. B

10条回答
  •  误落风尘
    2021-02-02 08:35

    Angular 8 has a new forms method: markAllAsTouched();

    This will mark a control/form and ALL DESCENDANTS as touched!!!

    So:

    this.form.markAllAsTouched();
    

    Is the solution.

提交回复
热议问题