输入框内容校验,以 / 开头不包含后面不包含空白符
<!DOCTYPE html>
<html ng-app="myApp">
<head>
<meta charset="UTF-8">
<title>input</title>
</head>
<body>
<form name="form">
<input type="text" ng-model="data" name="input" ng-model="data" required ng-pattern="/^\/\S*$/" >
</form>
<div ng-show="form.input.$invalid">starts with / ,space not allowed</div>
<script src="../lib/angular.js"></script>
<script>
var myapp=angular.module("myApp",[]);
myapp.controller("ctrl",["$scope",function ($scope) {
}])
</script>
</body>
</html>
这个正则表达式不能正常应对“/ ”
求指导
米脂
相关分类