[英]Validate file path with regular expression angularjs
I need to check if my input is correct. 我需要检查我的输入是否正确。 It must look like
Folder/game.dll
Here is my code: 它必须看起来像
Folder/game.dll
这是我的代码:
<input type="text" name="addRelativePath" ng-model="addGameModel.RelativePath" class="form-control" required ng-pattern="validationRegex">
My angularJs: 我的angularJs:
$scope.validationRegex = / (\w+[^.]\/)+\w+.dll /;
What is wrong? 怎么了? Nothing happend whem I submit my form and expression in input is incorrect.
我提交表单和输入中的表达不正确时,什么都没发生。
Are you checking form validy thorough the form controller property $valid? 您是否通过表单控制器属性$ valid检查表单有效性? It should be checked if not angular will submit the form
应该检查是否不成角度将提交表格
<form novalidate name="vm.form" ng-submit="vm.form.$valid && vm.submit()">
</form>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.