I'm working on custom form validation for an Angular application using ng-pattern
.
In my form I have:
<form name="jobsForm" id="jobs-form">
<div jobs-form jobs="jobs">
<div ng-form="jobsForm">
<div class="form-group">
<label for="source_path">Source Path:</label>
<input type="text" class="form-control" name="source_path" id="source_path" ng-model="jobs.source_path" ng-pattern="path_regex" required>
<span class="input-error" ng-show="jobsForm.source_path.$invalid.pattern">INVALID PATH</span>
</div>
</div>
</div>
<button type="submit" class="btn btn-primary-red" ng-click="submitJob()">Submit</button>
</form>
In my controller I define path_regex
:
$scope.path_regex = /^[a-zA-Z]:\\(((?![<>:"\/\\|?*]).)+(\\)?)*$/;
When I try it out, nothing works. What is the best way to debug this? Is it possible to put a breakpoint in and check my values for ng-show
?