using Angular validation directives with Breeze blocks any input that is invalid

后端 未结 4 1454
醉梦人生
醉梦人生 2021-02-20 14:15

If you add any of the angular directives for validation (ng-minlength, ng-maxlength, ng-pattern, etc.) to an input that is bound to a breeze entity it blocks any user input if f

4条回答
  •  悲&欢浪女
    2021-02-20 14:30

    Another solution to consider is to use the ng-model-options attribute made available with Angular 1.3+.

    In this way, you can prevent the Angular digest occurring after every keypress, and instead defer it to, for example, the 'blur' event so that the use has a chance to actually enter the valid data.

    It would look like this:

    
    

    However, this still has the limitation that if you enter invalid input, on blur the input will be cleared out and the use will have to enter it all again. Not very user friendly in my opinion, so I'll be trying out the breeze-only approach to circumvent this issue.

    However, I thought this solution was also worth mentioning here.

提交回复
热议问题