write an ng-pattern to disallow whitespaces and special characters

前端 未结 3 913
南旧
南旧 2021-02-02 11:45

I am trying to get an angular ng-pattern to check that a username has no whitespaces or special characters. The following form return false if you enter whitespaces or special c

3条回答
  •  暖寄归人
    2021-02-02 12:18

    in case anyone needs to disallow user entering emails in the address field

    ng-pattern="/^[^@]+$/"

    Please enter a valid address

提交回复
热议问题