609 questions
0
votes
2
answers
103
views
How can I implement a FormArray of FormGroups?
I have a Reactive Form in an Angular 21 application, and the form requires an array of a certain sub-form. (In my case the sub-form(s) define "filters" on a search.) The documentation on ...
2
votes
2
answers
86
views
Unable to show/get date values from formarray.controls
I am developing a timesheet form page in Angular 20.
I am using formGroup, FormArray and FormControl classes.
I am facing issues in retrieving and displaying the date values which I am pushing into ...
1
vote
1
answer
76
views
How to add item below the current item through button click of Angular Formarray
Like it says, I want to add an item to the middle of a FormArray. So, I have a FormArray and every FormArray item has a button to add a new FormArray item. However, it currently always adds it to ...
1
vote
1
answer
508
views
How to use PrimeNG Autocomplete with multiple selection in a FormArray?
I'm working on an Angular project where I need to implement a form that includes a FormArray with multiple FormControl instances, each using PrimeNG's Autocomplete component with multiple selection ...
0
votes
1
answer
28
views
Using FormArray and FormGroups I can't get the selected value of a select list
I'm working on a solution where I have a table grid that allow users to add and remove items from the table. Inside of each row are select columns that represent states, cities and mlb teams. I'm ...
1
vote
1
answer
67
views
Value is undefined in formArray
I have form array and for some reason I dont see any value in my app-input component. if I define simple formGroup contorl and pass to app-input I can see value. But in formarray happnes something ...
0
votes
1
answer
347
views
How to bind a formarray of form groups from parent to child component in Angular?
Need help from anyone who has worked on angular reactive forms. I have a parent component and 3 child components
In the parent component, I have a form which looks like this :
parent form :
...
1
vote
1
answer
144
views
Validator in nested FormGroup of FormArray does not work
I have an easy setup with Angular typed forms.
In the example I built a FormGroup with two FormControls:
A normal text field with required Validators
A form Array that contains a FormGroup with a ...
0
votes
2
answers
175
views
Accessing Angular Typed Form Property from a FormArray in the HTML Template
I’m working on a form that manages currencies, with fields for code and label. I’m using the latest Angular features and trying to leverage typed forms.
I have a FormArray inside a FormGroup, which is ...
2
votes
1
answer
89
views
<mat-form-field> component doesn't work properly with FormArray and formGroupName
The input field is not displayed with the appearance of <mat-form-field> before clicking inside when formGroupName is used with FormArray.
See the example:
TS:
formMain = this.fb.group({
...
2
votes
1
answer
93
views
Angular Reactive Form - ng-select in form array works remotely but fails when it's online
What I expect to achieve is selecting a product that comes with a price, adding the quantity, and then selecting another product still from that same list of products. The challenge is this works as ...
1
vote
1
answer
38
views
How to push collection of formgroup into formArray
I have a form in a steper (cdk) that works fine and I'm refactoring it to make it dynamic. My goal is to use json at the end to generate the form content.
Right now I have the following code:
export ...
-1
votes
1
answer
43
views
How to handle the Formarray in the Nested array in Angular
enter image description here
I need to render the Dynamic fields in the Angular. But, that one is solved. Then what the issue is when i render the Nested Array or a Group it's not rendering properly.
...
2
votes
1
answer
73
views
How to get the value from dynamically added nested form in angular using valueChanges?
I am dynamically adding formControl to a parent form by iterating an array of objects & want to track the change in these dynamically added controls by adding the valueChanges to the parent form ...
1
vote
1
answer
494
views
Handling tabs data in angular reactive forms
I am developing a calendar app and want to handle three tabs such as hours timing / out of office / holiday tabs in a form.
what is the efficient appraoch to group the form as there is one form and ...
2
votes
3
answers
1k
views
Cannot find control with path error after migrating to Angular 15
The migration from Angular 10 to Angular 15 has caused the following error on the console:
ERROR Error: Cannot find control with path: 'mappedHeaders -> 0 ->
value'
example.ts
headerArray: ...
0
votes
1
answer
251
views
Angular 17 - How to add errorStateMatcher to Form Array, but one that traverses formGroups at consecutve indices
the below code works,
https://stackblitz.com/edit/stackblitz-starters-wnququ?file=src%2Fmain.html
But I need to take it a step further and ensure that the end date of the FormGroup at index (x) is not ...
0
votes
2
answers
545
views
Angular - Cannot get ErrorStateMatcher to work with FormGroup inside a FormArray
This works on a simple form, with a single start and end date, but now the form I have is dynamic which has multiple pairs of start and end dates, so I've had to use a FormArray.
Here is the structure,...
1
vote
1
answer
527
views
How to use cdkDropList with Angular FormArray and FormGroup?
I am trying to use a FormArray in combination with a cdkDropList. But as soon as I add the corresponding FormGroup, the cdkDrag within that group stops working. So do any other events, like click ...
1
vote
1
answer
296
views
FormArray with nested FormGroups. How to access the nested form group controls?
I have a FormArray with 3 FormGroups and each form group has 2 controls. Im not sure how to access the controls within the form groups to set the form control name.
setting up the form
this.form = ...
1
vote
2
answers
58
views
HTML iteration of nested formArrays
Is it posible to have a formArray nested inside of other formArray and show it properly in the HTML view?
I'm building a paginated form based on an API response, so I'm iterating over my response to ...
1
vote
1
answer
55
views
Angular array to display value based on another control value
I am working on billing of product page based on product list using Angular as front end.
Here when I selected product "apple" the price should be calculated and displayed in price control ...
0
votes
2
answers
459
views
Error Populating FormArray using FormGroup in a for loop: Angular 17
I am getting the following error when trying to populate a FormArray in Angular (version 17):
Argument of type 'FormGroup<{ name: FormControl<string | null>; amount: FormControl<number | ...
0
votes
1
answer
585
views
Angular 17 - Error when creating reactive dynamic form array with child component
I'm trying to create a dynamic form array in Angular 17 with a child component handling part of the input. However, I'm encountering an error:
Type 'AbstractControl<any, any>' is missing the ...
0
votes
1
answer
64
views
How to place condition while, looping form array in html
I have a formarray in the form, Need to hide and show based on dropdown value - is_dependent_exist
I have tried like below:
var all_user_custom_fields = [
{
'field_name_slug': '...
0
votes
1
answer
49
views
Angular - ERROR Error: Cannot find control with name: 's..Address'
I have the following component in HTML:
<div>
<form [formGroup]="dynamicFormGroup" (ngSubmit)="onSubmit()">
<div class="form-row" *ngFor="...
0
votes
1
answer
291
views
Showing items in Form Array
I need to show users' names and a list of their courses. Different users have different numbers of courses. Thus, I am trying Angular Form Array.
Here is my .ts:
this.form = this.fb.group({
name: [''...
1
vote
1
answer
948
views
Error on creating dynamic form in Angular 17
I want to create a dynamic form that is an array of payments, the user can add a new payment, delete from the array, and edit.
My HTML:
<form [formGroup]="createLoanPaymentsForm" (...
0
votes
1
answer
143
views
Unable to edit input fields when using formGroupName
This is how I set my form control:
formMain = this.fb.group({
details: this.fb.array([
new FormGroup({
label: new FormControl(''),
description: new FormControl(''),
})
])
});
...
1
vote
2
answers
90
views
Angular FormArray can't bind to my FormControls
Hi i have a component template recipe-edit.component.html:
<div class="row">
<div class="col-xs-12">
<form [formGroup]="recipeForm" (ngSubmit)="...
0
votes
1
answer
61
views
Angular Input value is not changing in FormArray
I have a FormArray in PreprocesssingForm. Here, Sequence No is not getting changed when I add a new row.
<tr class="mat-row" *ngFor="let dynamic of PreprocessingForm.controls....
0
votes
1
answer
159
views
How to get data from FormArray in Angular
I want to define a question which has some answers. Here is my code:
formGroup!:FormGroup;
answerFormGroup:FormGroup=this.formBuilder.group({
text: ['d', Validators.required],
value: [0, ...
2
votes
1
answer
99
views
How to create nested dynamic form elements
I want the select-option and input-text fields to be added once when I click on the Add button.
I've already achieved this. That's okay.
When I click on the Add Serv button, the input-text field in ...
0
votes
1
answer
22
views
Can't get Angular Dynamic Nested FormArrays to work
I'm trying to make an array of books where each book has multiple authors that I can add or remove
I'm trying to learn angular and I've come across a need to have an array nested within another array.
...
1
vote
2
answers
148
views
Angular - Get errors in reactive form with loop for the FormArray
I'm using Angular CLI version 16.2.1.
I'm following a course and I'm using reactive forms: In a 'Recipe' list I need to add a Recipe with some inputs and a list of ingredients. The problem is that ...
0
votes
1
answer
79
views
src/app/reactive-form/reactive-form.component.html:47:48 - error TS2531: Object is possibly 'null'. src/app/reactive-form/reactive-form.component.ts
Object is possibly 'null'. Element implicitly has an 'any' type because expression of type '"controls"' can't be used to index type 'AbstractControl<any, any>'.
Property 'controls' ...
0
votes
1
answer
196
views
Angular FormArray: Removing Selected Items Leaves Undefined Values
I'm encountering an issue with an Angular application where I have a FormArray representing a list of selected items. When I select items from a list and then deselect them, undefined values are left ...
1
vote
1
answer
57
views
Formgroups and FormArray
From data that I recive from API I want to create a reactive form.
I have a formparent and multiple childforms. The data that I want to display in form looks like this:
data{
"...
0
votes
0
answers
45
views
Reactive Forms - How to fix AbstractControl error?
I have the following definitions for a FromArray: manageIds!: FormArray
I use the following function to generate the form controls dynamically in the HTML:
getControl(form: FormArray, index: number, ...
-1
votes
1
answer
867
views
Angular nested FormArray Cannot find control with name: '0-1'
I am pretty new to angular and learning formArray. I have 2 simple lists of roles and rights. For this, I need to plot a checkbox matrix as follows. Also, at the bottom of every column, I need to show ...
0
votes
0
answers
577
views
cdkVirtualFor doesn't work with FormArray
I have problem with cdkVirtualFor with FormArray. It doesn't generate any items.
My html:
<cdk-virtual-scroll-viewport
[itemSize]="100"
class="viewport-container"
[...
0
votes
1
answer
457
views
Angular Filter FormArray by index
I have a reactive form that is referenced via an accessor, I want to filter it by returning the index that matches the search term from the input field.
ts file
//accessors
get listAccessor() {
...
1
vote
1
answer
751
views
primeng p-table filter with editable FormArray - FilterService Value getting null
I'm facing an issue while implementing filter on primeng p-table with formarray controls, Filter didn't work properly, So registered custom filter and tested then the value is null for all the rows, ...
0
votes
1
answer
286
views
Angular FormArray not detecting inputs for formcontrols of last element
trying to create a formarray of multiple formgroups, the issue I am facing is kind of strange,
the formcontrols present in last element of formarray , is not taking input values
add-modules.ts file
...
0
votes
0
answers
22
views
How to get latest reordered form array after drag and drop in Angular
I used drag and drop on nested form array. It has lot of fields. After drag and drop how can I get rearranged formArray list by this.columnsArray(i).value?
dropRow(event,i) {
moveItemInArray(this....
0
votes
1
answer
63
views
How strings' array into FormArray Angular
I have array (gifts) of objects, after filled valid form by user, I want to check which checkboxes are checkIn, next push name of selected gifts into giftsArr and on submit-action push into gifts ...
2
votes
1
answer
3k
views
Angular Reactive forms: FormArrayName with an ng-template
For a variety of reasons, I need to have a formArrayName directive applied to a div with as a child a ng-container with a ngTemplateOutlet.
Let me clarify it with HTML templates.
The following ...
1
vote
1
answer
2k
views
Why is FormArray value not updated when I edit input field?
I have angular reactive form consisting of few FormControl and one FormArray element.
competitionForm!: FormGroup;
this.competitionForm = new FormGroup({
name: new FormControl(this....
1
vote
2
answers
972
views
How to disable submit button if a form array is empty?
I have a form array in my angular form. I want to apply validation to this form array. If the form array is empty the submit button should be disabled. The condition for submitting the form is that it ...
0
votes
1
answer
864
views
Angular FormArray setValidators does not work when setting dynamically
I have a formGroup which has a formArray, which contains of {key: '', value: ''} formGroups. I want to make the value formControl to be required when the key formControl is not empty. I have ...