Check if a input box is empty

后端 未结 6 1498
南旧
南旧 2020-12-08 01:48

How can I check if a given input control is empty? I know there is $pristine property on the field which tells that if a given field is empty initially but what

6条回答
  •  感情败类
    2020-12-08 02:25

    If your textbox is a Required field and have some regex pattern to match and has minlength and maxlength

    TestBox code

    
    

    Ng-Class to Add

    ng-class="{ 'err' :  myform.myfieldname.$invalid || (myform.myfieldname.$touched && !model.myfieldmodel.length) }"
    

提交回复
热议问题