Questions tagged [ng-required]

26 questions
4
votes
1 answer

how to make ng-required true if any of the related object field filled?

By default the first person's details required="true" but the rest person's form are required="true" based on any of its filed filled or not. The current issue of the snippet is that, it is not validate when last person's any one field filled.…
Mo.
  • 26,306
  • 36
  • 159
  • 225
3
votes
2 answers

Angular ng-required

I've got my FormGroup with some FormControles and all of them are required but I want two of my FormControles only to be required if a boolean in my component.ts is true I tried ng-required="myboolean" but this didnt work. Is there a way to do this…
Kajot
  • 1,043
  • 2
  • 15
  • 22
2
votes
1 answer

AngularJS - problems with ngRequired and conditional undefined

I have always used ng-required with conditionals undefined like that: I've never had any problems with this until…
2
votes
2 answers

Red asterisk after ng-required input (without label)

I'm looking for a CSS rule to apply a red asterisk after the inputs with the ng-required attribute. The thing is, there is no label on those inputs, the placeholder is used as a label. Those 2 inputs for instance :
Ellone
  • 3,644
  • 12
  • 40
  • 72
1
vote
1 answer

md-select and required doesn't detect empty value

I am trying to make a select option has required using angularjs and md-select. The problem is, is not doing anything. I've seen multiple issue on github, but no valid fix.
Bobby
  • 4,372
  • 8
  • 47
  • 103
1
vote
1 answer

NG-Required not working on search input fields

I have a text box that is a search box (input type ="search") that I want to use the ng-required directive on it as needed. The issue is if I set ng-required = true there is no red box around my textbox. If I change the input type = "text" it works…
Terrance Jackson
  • 606
  • 3
  • 13
  • 40
1
vote
2 answers

ng-Required for Checkbox

I have an array of checkbox controls added in index.html. I want to check if atleast one checkbox is checked when the user clicks on submit button. I tried the below code, but it does not seem to work. In index.html:
venkat14
  • 583
  • 3
  • 12
  • 34
1
vote
1 answer

Custom Directive for Required/ngRequired

I want to validate a dropdown with required. Default required only works if value is null or blank (correct me if I'm wrong). I want required to give error and make form invalid true if value is 'not assigned'. All are working except the select dropdown. I have it so…
Patrick McDermott
  • 1,220
  • 1
  • 15
  • 30
0
votes
1 answer

AngularJS ngRequired custom directive

I have small directive to add required class to closest label of form element. It works fine with attribute required, but when using ng-required it seems to be not binding directive to element. How to dynamically trigger directive binding on…
Justinas
  • 41,402
  • 5
  • 66
  • 96
0
votes
2 answers

Conditional pattern to be used along with required Angular7/8

In my template driven form the textarea is required based on a condtion. I would also like the pattern to be conditional. I tried this syntax based on a question from angular 1.x but it doesn't seem to work. - pattern=" condition ? '.*[^ ].*' : ''"…
Flash
  • 924
  • 3
  • 22
  • 44
0
votes
0 answers

Custom Angular Validation based on a selection radio select button

I need some help in that i have validation working partially. When one selects a payment method called CC the user input needs validation to kick in instantly and wont allow one to input the wrong number or be able to pay(the button will be…
0
votes
1 answer

myForm.$valid returns true even though required feld is empty

I have a form myForm with some input fields. What am I trying to implement: Each field is required only if at least one of the others input fields is not empty. How I do it: I set ng-required="ctrl.isAtLeasOneFieldSet()" on each field. This function…
Elio
  • 428
  • 3
  • 20
0
votes
0 answers

Angularjs - ng-invalid not working correctly on select element inside ng-repeat table