Angularjs validation patterns, syntax and properties. Validation of forms, controls, models using various angular validation directives.
0
votes
1answer
13 views
Angular - Requiring ngModel and using it in controller of custom directive, not link function
Can anybody tell me if it's possible to require and use ngModel inside the controller of a custom Angular directive. I'm trying to stay away from the link function. I see most examples use the link ...
0
votes
0answers
10 views
angularjs form validation for file input
I am using Angularjs form validation. I have a textfield and file upload filed. Currently I have handled the validation for either one of them should be present. But there are few additional rules ...
1
vote
1answer
38 views
AngularJS form remains $dirty setting every input $pristine manually
I have a HTML form[name="mainForm"] with many inputs.
When I modify an input the $scope.mainForm.$dirty becomes true (and that's right) but when I setPristine() a field I have previously modified ...
0
votes
1answer
26 views
AngularJS trigger field validation after form loads
I have set of data fields.
They look like this:
// Read-Only
<div class="field-group" ng-if="feature.edit == false">
<div class="label" ng-class="{'feature-required': ...
0
votes
4answers
99 views
Text Input allow only Integer input in angularjs
I want to set the html input[number] <input type="number" /> to allow only integer input (not float).
Basically, the html input[number] allow '.' to be entered for float input and I don't want ...
1
vote
1answer
77 views
Validation on fields using index position
I have a couple of fields that I would like to replicate dynamically. I'm using ng-reapt which is doing the job. However, the validation messages are not working. Here's what I've got:
<html ...
0
votes
0answers
40 views
validation with dynamic names in AngularJS
This question was asked at least two times before Question 1 Question 2 but I thing that the answer was not complete many people use static name with ng-repeat, it's a possible solution but in my case ...
0
votes
0answers
28 views
angular validation: return different error messages for each different pattern error
My clients asks that a password field returns a different error message for each different password error. For example:
- Password is too short (if less than 8 chars)
- Password does not contain ...
2
votes
1answer
74 views
Prevent async unique validator to validate same value only when editing?
I've got an AngularJS form that has a custom validator to check with the server backend whether the input value is unique or not. The unique validation is done by the mob-async-validate-unique ...
0
votes
1answer
36 views
validate dynamic form before submitting angular
I'm dynamically creating forms with ng-repeat and they have some validation attributes (simplified version):
<div class="row" ng-repeat="defect in model.defects">
<form ...
1
vote
2answers
54 views
conditional styling on Form Validation AngularJs
<label class="item item-input margin5px">
<input type="email" name="email" class="form-control" placeholder="Email" ng-model="user.email" ng-minlength=5 ng-maxlength=100 required>
...
2
votes
1answer
185 views
AngularJS Form Validation: $valid Always True
I'm having trouble with AngularJS form validation. Below is a simple two-field form with the only requirements being that data for each field is required, one of which is of "email" type.
The trouble ...
0
votes
1answer
45 views
Is ng-pattern possible on contenteditable elements?
Can't seem to find any info on this. Is it possible to use ng-pattern on a contenteditable div? When I try it doesn't work:
<div contenteditable="true" ng-model="x.number" ...
1
vote
2answers
185 views
AngularJS Validation framework
Is it feasible and not particularly arduous to create a validation framework that could be used in the following manner:
var myValidations =
[
{ 'A',
'This is required',
...
4
votes
3answers
175 views
How to use the last valid modelValue if a model becomes invalid?
I'm working on an application that saves changes automatically when the user changes something, for example the value of an input field. I have written a autosave directive that is added to all form ...
0
votes
2answers
91 views
how to validate input in angularJS before the button press to add item in html table
How to validate the input elements before performing any operation, I have four html input element and html table when you click item on add to list it added item in HTML table now my problem is ...
0
votes
1answer
32 views
Angular validator, pass data along with error code to be displayed in ngMessages
Is that possible to store some additional data along with the error flag itself, using standard Angular mechanism?
i.e. I'm manually setting ngModel.$setValidity, I'd like to pass some data along ...
1
vote
1answer
248 views
ng-required not working as expected if parent div is hidden conditionally
In my code I am using ng-show and ng-required in combination. But, ng-required is not working as expected even when the respective $scope variable value is set to false. Please find the code below
...
0
votes
1answer
87 views
AngularJs and Controller alias
I tried to alias the angular's controller in the view, but for some strange reason - it does not seem to respond when I prefix the methods and properties - any idea what might be causing it?
Here's ...
0
votes
1answer
43 views
Share validation state for multiple fields against the same validator
I will start out stating that I have searched google and SO and I have not found an answer for this specific situation. Yes, there are other posts that sound the same but are more based on a "MoreThan ...
0
votes
1answer
166 views
Validate field count in angular form
I have a form where a model contains an array of sub-models, like this:
<form name="form1">
<div ng-repeat="sub in model.submodels">
<input ng-model="sub.name" required>
...
2
votes
1answer
264 views
Angular radio button validation with an ng- repeat
I'm running into an interesting Angular validation issue. I need to make sure that radio buttons are selected (they might not have a default value when loaded). The values for the radio buttons are ...
0
votes
0answers
24 views
Revalidate dependant inputs
I have a form with two inputs. The first one is the current working directory and the second one is a file name. I use angular ui validate to create custom validation rules that checks if the ...
0
votes
1answer
217 views
Why does adding additional AngularJS validation directives cause $asyncValidators to run multiple times?
Why does adding additional AngularJS validation directives cause $asyncValidators to run multiple times on page load?
I created a custom directive which implements $asyncValidators. This is the ...
1
vote
0answers
109 views
angularjs form.$valid always true
I have a form and I want to check its validation, but form.$valid return me always true, also when form is not compiled!
<form name="compileForm" novalidate>
<table class="mytable">
...
0
votes
0answers
190 views
AngularJs+TypeScript:- How to apply validation without using form tag
i have implemented a module where i have declared my ng-controller and ng-app in my div only because if i m using form tag it will not load my typescript controller and not showing any error in ...
1
vote
3answers
97 views
Angular JS Form validation not working
I am trying to do a simple form validation using angular js. But it doesnt seems to work and I am not getting what I am missing.
HTML
<form role="form" class="ng-pristine ng-valid" ...
2
votes
1answer
56 views
AngularJS Date Pattern Validation Changes from v1.3 to v1.4
I recently asked this question about the changes to RegExp pattern validation that were introduced in AngularJS v1.3. The answer I received apparently solved my problem, but now I am trying to apply ...
0
votes
1answer
130 views
How can i add validation ng-maxlength into ng-repeat with error message?
I have a simple code :
<div class="row" ng-repeat="aDiagnosis in diagnosisListForPrescription">
<div class="col-md-4 padding-right-zero" ...
0
votes
1answer
238 views
Comparing input value with value of an array in AngularJS
I have a problem with the validation about existing values. I don't know how to compare two values and add the new value only, when it isn't exist in the Database. I've tried with angular.forEach() ...
1
vote
0answers
158 views
FCSA number does not validate a negative number if assigned by the controller
I'm working with FCSA number
If I enter a negative number in the component, the validation work correctly but if I value the variable ng-model from the controller, the validation is not working.
...
0
votes
0answers
29 views
AngularJS: validate uniqueness of fields in an ng-repeat
I'm have several places in my UI where I have an ng-repeat in a form and I want to use a custom validator to make sure the user doesn't enter duplicate field entries. About a week or so ago I had ...
0
votes
0answers
41 views
unable to edit/modify fields in my angularjs form
I am displaying a form in a modal. But when I click on the text input field it is not allowing me to enter text. similarly unable to change/select radio buttons
But when trying with "tab" it is ...
1
vote
2answers
562 views
Angularjs validation - bootstrap datepicker input is not recognized
If you read following Angularjs validations, you understand that:
Message will appear if user interacted and did not fill the date manually.
The problem is when date is filled using the datepicker the ...
0
votes
0answers
34 views
Angularjs Nested Forms
I have a use case where I have a main form for editing data in an angularjs app. This data also has line items that I want to allow users to be able to add. However each line item should be ...
3
votes
2answers
124 views
angularjs - not able to invalidate input (Object doesn't support property or method '$setValidity')
I try to do the following
if ($scope.RetypePassword != $scope.resource.Password) {
$scope.resource.Password.$setValidity("missmatch", false);
} else {
...
0
votes
0answers
92 views
Validation to check field duplicate in data with multiple rows
Validation of duplicate field value:
I have a form that has field dataStream and I want to check it against my previous values of dataStream for duplicates.
I am using directive to check for ...
0
votes
2answers
357 views
AngularJS password confirmation noMatch working but form is $invalid?
I am using this code to make password input and confirm password input to match correctly
Javascript:
var app = angular.module('app', []);
app.directive('validPasswordC', function() {
return {
...
2
votes
1answer
223 views
angularjs : clearing form after submit shows error message?
Hi I have form where I am using many fields. After submitting and if everythign goes fine I am clearing or setting form to default state but I am still getting error message.
<div>
...
2
votes
2answers
61 views
Making and Angular form invalid when inputs aren't required
I'm making a profile editor directly on the user's profile page in where I want to show a live preview of the changes they are making.
I'm basically updating the view using models attached to inputs ...
3
votes
1answer
61 views
Why does an invalid form is valid at first and right after turns out invalid?
In order to simplify things I made up a sample form to describe my question:
<form novalidate name="form">
<input required name="foo" ng-model="my.foo">
</form>
And also a ...
0
votes
0answers
166 views
Validation in angularjs through directives
i am using directives to validate a textbox which should have only numbers. The problem is that when i copy & paste special characters in the textbox it is removing the special characters from the ...
3
votes
4answers
184 views
AngularJS 'controller as' and form.$valid
I want to check if a form is valid inside an angular controller. This seems straightforward when using $scope, but I can't get it to work with the 'controller as' syntax.
When I attempt to access ...
0
votes
2answers
375 views
How to set the validation on blur event?
I have wrriten some sample in plunker. I need to validate my input when the user leaves it. I used ng-model-options="{ updateon: 'blur'}" for this. ng-minlength works fine but this doesn't apply to ...
0
votes
1answer
147 views
angularjs checking dirty status of elements inside particular div
i have a form like this and i like to user angularjs for form validation
<form name="userrequest">
<div id="userdetails">
<input type="text" id="buyerName" />
</div>
<div ...
-1
votes
2answers
56 views
Restricted validators names in Angular
I've created custom validator and attached it to the input element's model like:
ngModel.$validators.required = function (value) {
return !!value;
}
And it does not work - function is not even ...
3
votes
2answers
176 views
Reusing validation conditions in Angular
I like the granularity of Angular's form validation states, but it can get a little clunky when you have a form with lots of fields- even two fields start to make your markup a little soggy. Take the ...
0
votes
2answers
92 views
angular removes ng-model variable if ng-required is true
as in the title.. how to prevent such operations to happen? Here is a link to the official site, see the example. The variable user.name is bound to the first input userName and if the input is empty ...
0
votes
1answer
76 views
angularjs Click to Edit with validation
Im having a problem in my forms in validating empty fields. When the user clicked the edit button and clear the input field then click the send button, there is no validation that’s happening. I’ve ...
0
votes
2answers
336 views
ng-disabled in Angular validation not working as expected
http://plnkr.co/edit/9Yq6aZHtKCuZMtPbjBIN?p=preview
I've tried and tried to get this to work but I've had no luck. I'm trying to disable the submit button using angularJS and the built in validation ...