Angular Material - show mat-error on button click

后端 未结 10 1800
刺人心
刺人心 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:15

    Either you can do as "Kyle Pfromer" suggested or as you are using form group, you can mark element as touched on submit with

    onSubmit(){ this.formName.get('formControlName').markAsTouched(); }
    

提交回复
热议问题