Check if a input box is empty

后端 未结 6 1509
南旧
南旧 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:24

    Even you don't need to measure the length of string. A ! operator can solve everything for you. Remember always: !(empty string) = true !(some string) = false

    So you could write:

    
    Sorry, the field is empty!
    Thanks. Successfully validated!
    

提交回复
热议问题