这个不是ng-pattern或者你的正则写错了原因,而是因为angular的input的ngTrim属性默认为true ngTrim (optional) boolean If set to false Angular will not automatically trim the input. This parameter is ignored for input[type=password] controls, which will never trim the input. (default: true) 也就是默认会对input的value默认进行去首尾空格的处理,这里你只需要加入 <input ng-trim="false" /> 应该就好了,还有问题可以留言
这个不是ng-pattern或者你的正则写错了原因,而是因为angular的input的
ngTrim
属性默认为true
应该就好了,还有问题可以留言