Angular 2 form validation, minLength validator is not working

前端 未结 7 1661
旧巷少年郎
旧巷少年郎 2021-02-06 21:04

I have following Angular 2 form:


    
&l
7条回答
  •  一生所求
    2021-02-06 21:17

    This really caught me out as well as I matched the key in my markup to what I had in code which is incorrect.

    Sample Code

    password1: ['', [Validators.required, Validators.minLength(8)]],

    Sample Markup

    *ngIf="registrationRequest.get('password1').hasError('minlength')"

    Note in the code it's minlength entirely in lower case.

提交回复
热议问题