In my angularjs form, I am checking the password pattern with a regex that checks for multiple conditions. Based on different condition checks of this regex, I want to change the css for one of the elements.
The source model that inspired this is from here.
This is my function to check the pattern against the regex :
$scope.passPatternCheck= (function() {
var regexp = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[!#\$%&'\(\)\*\+,\-\.\/:;\<=\>\?@\[\\\]\^_`\{\|\}~]?)[A-Za-z\d!#\$%&'\(\)\*\+,\-\.\/:;\<=\>\?@\[\\\]\^_`\{\|\}~]{8,}/;
return {
test: function(value) {
return regexp.test(value);
}
};
})();
Some notes:
- this regex don't check for the starting/ending spaces; this should also be adjusted
- the
ng-if
that shows/hides the div of the conditions list is not currently working.
question:
I want to reproduce the same behaviour from the godaddy site account creation page. So the goal is to have the same css behaviour according to the condition completed.
update 2:
my submit button of the form theForm
should get disabled if any of the fields that are required are not filled out or an error in the patterns occurred:
<button type="submit" class="btn btn-primary"ng-disabled="theForm.$invalid" ng-click="submit()">
</button>
but with the Shantanu's answer, this is not yet possible.