2,650 questions
0 votes
1 answer
38 views
How to dynamically update form fields associated with specific classes in Angular?
I'm working on a dynamic form in Angular where form fields are grouped by category, and each group is associated with a specific class (e.g., Revenue, Loyer, Epargne). I'm trying to figure out how to ...
1 vote
1 answer
461 views
How to implement setDisabledState from ControlValueAccessor interface using new input API [Angular19]
After attempting to run a migration for the new input API (with --insert-todos enabled) my custom Text Input component looks like this: text-input.component.ts export class TextInputComponent ...
0 votes
1 answer
41 views
How to map properties from an angular reactive form to an object only with class member properties?
I have tried mapping reactive form properties to an object class using (Object.Assign) but it adds extra properties that doesn't belong to the class or interface, ex: export interface MyInterface { ...
1 vote
1 answer
48 views
max length is not working angular 2 plus version
I am working on an application where I am implementing max length but it is not working. below is my implementation TS this.customPaymentForm = new FormGroup({ amount: new FormControl(...
1 vote
0 answers
321 views
Angular form not detecting autofill changes
I'm encountering an issue with my Angular application where the form doesn't detect autofill changes, resulting in the form submission button remaining disabled even when the form is filled. ...
0 votes
0 answers
155 views
Mat-error not triggering in custom phone input component implementing ControlValueAccessor and Validator
I am trying to create a custom phone input component by implementing ControlValueAccessor and Validator in Angular, but I have an issue with mat-error not triggering. The FormGroup seems to work, as ...
0 votes
3 answers
2k views
How Remove custom Validators with method RemoveValidators
I have a question how can I remove my custom validators in the easiest/best way? I know that since angular 12 there is a method RemoveValidators, it is based on the reference of a given validator, ...
4 votes
1 answer
196 views
How to access an Angular2 component's methods from another component?
I am working on an NgForm that is supposed to have a "Reset all fields"-button. I can access NgForm.reset() to reset most of the fields. But I have a couple of instances of a custom ...
1 vote
2 answers
472 views
set Angular form validator behaviour for particular validator
Is there any way we can set different validation behavior for different validators? for example, { field1: ['', [Validators.email, Validators.required]], field2: ['', Validators.required], }, ...
0 votes
1 answer
2k views
Angular Error: Type 'AbstractControl | null' is not assignable to type 'AbstractControl'
I tried to fix this problem with an $any(), but I don't think I did it correctly. Could someone help me with this error, please? The error occurs on these lines of code: get email(): AbstractControl { ...
1 vote
0 answers
728 views
How to pass data from parent to child in template driven form
My problem is with Template Driven Forms. I have two components (parent and child) and I want to pass default values for controls inside child component. In child component I have reference to the ...
0 votes
1 answer
560 views
Creating a reusable method attach to input field for multiple components in Angular
I am beginner in angular and started working on angular 12 project. I am working on reactive forms where I am adding on Blur method to add class to my input field on some error conditions to give ...
0 votes
0 answers
536 views
Dropdown plus manual text field in angular form
I am beginner to angular and I have angular form in my application where i want to add dropdown field , if user entered value does not exist in dropdown then allow him to enter some new value and we ...
1 vote
1 answer
1k views
Iterate through a formArray containing inside other model values
I have question how can i iterate through formArray and use inside data from other array. I added example below: @Component({ selector: 'app-reactive-form-test', styleUrls: ['./reactive-form-test....
1 vote
2 answers
3k views
How to patch a nested form Array?
I have data coming from a form(modal) that I have to patch into another form (collapse). this is the form where the data is coming from. formInitializer() { this.agrmntsForm = this.formBuilder....