2,131 questions
1
vote
1
answer
29
views
How do I pass error state from Angular 21's new FormValueControl to the outside?
I have implemented a simple custom control using Angular 21's new FormValueControl, see StackBlitz:
export interface Test {
booleanValue: boolean;
stringValue: string;
numberValue: number;
}
@...
Best practices
0
votes
0
replies
32
views
Angular Signal Forms with Resources
When building a component that uses Signal Forms to edit an object, the object needs to be loaded and then updated into the formModel. I want to use a pure Signal/Resource solution as opposed to using ...
1
vote
2
answers
118
views
Angular 21 Signal Forms: TypeError: this.field(...) is not a function
I have written a very simple component that implements FormValueControl and uses a signal form internally, see below:
import { ChangeDetectionStrategy, Component, model } from '@angular/core';
import ...
1
vote
2
answers
270
views
How to provide default values for individual fields in Angular 21 Signal Forms (without UI flicker) when implementing a FormValueControl?
We're starting to look at Angular 21's new signal-based forms, but I can't find a clean way to define default values for each form field, especially when building forms for objects where multiple keys ...
0
votes
0
answers
52
views
Why are child controls not updating to disabled when using a custom Angular control in reactive forms?
I have a complex set of objects that I need to edit. Basically, I have several objects at the top level, which may or may not be enabled, and each one has some complex sub-objects. The whole set of ...
2
votes
2
answers
68
views
Angular Reactive Form still includes empty values in form.value even after applying validators
I'm using a
Angular 20 with Reactive forms. Even after applying Validators.required to some controls, the form still includes empty string ("") or Null values when I log or submit form.
I ...
2
votes
1
answer
63
views
Angular reset to pristine from inside ControlValueAccessor implementation
I have a ControlValueAccessor implementation for custom form control:
@Component({
...
providers: [
{
provide: NG_VALUE_ACCESSOR,
useExisting: forwardRef(() => ...
2
votes
0
answers
67
views
Form not updated when Browser auto-fills saved email/password until user interaction [duplicate]
I have a login form in Angular 16 with FormGroup validation.
When I open the login page in Chrome, the browser auto-fills the saved email and password fields. The values are visible in the input ...
1
vote
1
answer
45
views
If show template with disabling a form at the same time - then a form not disabling
Working on a form with two templates.
It seems that if we change template + setting form as disabled, the form is not disabling. But if we do it with separate thread via setTimeout, we have corrent ...
1
vote
1
answer
43
views
how to detect formly toggle field type is disabled?
I have a formly form with toggle field, I would like to detect when the user clicks on the toggle to disable it.
here is what I have done so far:
fields: {
key: myToggle,
...
1
vote
0
answers
87
views
Animating angular form
I am using angular 20 and angular material 20.
I have a 2 forms at 2 stages that need to be transitioned between after a delay. I have a common animation I am using for when elements attach and detach....
0
votes
1
answer
87
views
How to save data from multiple forms on button click function? [closed]
I have succeeded in creating multiple forms based on the value from the dropdown list, but I am not able to save the data from the input element into database. If my dropdown list displays the value 5,...
1
vote
1
answer
50
views
Can a form submission refresh the page even without using [FormGroup]?
I'm making a multi-step form, the issue I'm facing on step-one is the page is refreshing instead of moving to the next step after the form gets submitted
my .html file goes like this:
<form (...
0
votes
1
answer
99
views
Create a new FormGroup with FormControls using a generic type
I am working on an Angular component that manages a list of FormGroups. This list can be expanded and items can be deleted.
But I also want the component to handle any kind of FormGroup. So for ...
0
votes
2
answers
66
views
Filter not working after including blur validation - angular material autocomplete
After adding blur validation to the angular material autocomplete dropdown, the search filter is not working properly when on change, instead filtering is happening on blur.
Expected behaviour: If ...
2
votes
1
answer
95
views
How to handed a relationship between two signals by linkedSignals in Angular v20?
I have to mange a relation for X*2=Y, there Y and Y are input fields.
In the moment, I trigger by a change of the input field the related variable as
X changed => Y=X*2
Y changed => X=Y/2
import ...
1
vote
2
answers
87
views
Angular FormGroup doesn’t get disabled when it contains an empty FormArray _and_ a custom form control
I have a simple FormGroup in an Angular component:
// app.component.ts, part 1
export class AppComponent implements OnInit {
protected form = new FormGroup({
ctl: new FormControl(),
arr: new ...
1
vote
1
answer
61
views
SetValue is not triggering Dropdown's (change) function
In Angular 19, I need a function to run when a dropdown changes value. However, it doesn't happen when using setValue.
html
<select id="dropdown" [formControl]="dropdown" (...
7
votes
5
answers
309
views
How to filter user input in Angular?
I want to filter user input when they type in an HTML text input.
I can do that in native HTML/JavaScript as shown in the following demo:
<form>
<label for="tracking">...
1
vote
1
answer
80
views
Angular Test harness not setting ngModel variable in MatSelect
Using MatSelect and working on UTs.
Post selecting a option via test harness, not able to see ngModel variable binding working.
Here is the html snippet:
<mat-form-field class="dropdown-...
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 ...
2
votes
1
answer
197
views
how to search in signal list in angular
I have a list of signal type.
searchModelDriver: string = '';
driverList = signal<any[]>([
{ fullName: 'test1' },
{ fullName: 'test2' },
{ fullName: 'test3' },
])
I also have a ...
1
vote
1
answer
69
views
Issue with activating validators on Angular reactive form at runtime - using form.updateValueAndValidity()
I have a simple yet perplexing problem.
I have a reactive form and I want to set validation programatically.
this.boatForm.get('boatType').setValidators(Validators.required);
this.boatForm....
1
vote
2
answers
102
views
What is the relationship of NG_VALUE_ACCESSOR, ControlValueAccessor interface in angular?
What is the relationship of NG_VALUE_ACCESSOR, ControlValueAccessor interface in angular?
Is if I have the following statement (provide:NG_VALUE_ACCESSOR)
@Component({
selector: 'rm-header',
...
1
vote
2
answers
86
views
How to send data from a component with no use of button to its parent in angular
I have host component and inside it there's three components(children).
First child has a form with no submit button, while second child has again a form with submit button, Plus third child has just ...
1
vote
1
answer
59
views
How to reorder items in FormGroup?
I have element in a FormGroup, let say
const langs = ['en', 'de']
form = new FormGroup({
languages: [langs, [Validators.required]]
descriptions: initChildGroup(langs)
})
initChildGroup(langs) {
...
1
vote
1
answer
51
views
Angular when I try to change variable "size" to "mensaje" @Input, it doesnt Work with "mensaje"
I try to share data from Parent to Child and Child to Parent, with variable in template PARENT "mensaje", the template receive this input and show in the input text Child, but when I type ...
2
votes
1
answer
47
views
How to save the value of textbox with dynamic route data into database?
Tagid and typename textboxes are currently holding routed values from customer component, but are not being saved into the database when I clicked on save button. In other words, routing the dynamic ...
2
votes
1
answer
42
views
Automatically Insert static value into textbox based on radio selection?
All of the values in the textboxes are saving correctly into the database except remark field which is displaying null. From my shared codes below, when l checked on score radio button, remark textbox ...
1
vote
2
answers
84
views
Dynamic custom component radio buttons do not have unique name when duplicated
I have the following form with a set of radio buttons in each section I can only select one of the buttons at any given time.
It appears that they do not have unique names.
The form is dynamically ...
0
votes
1
answer
47
views
Angular, [(ngModel)]="abc", unknown how the part (ngModel)="abc" works
In Angular, [(ngModel)]="abc", I know this mean two way binding, change value abc in model (ts) will reflect in view (html), change the view value will update the value in model, as tested ...
2
votes
2
answers
691
views
Why does my Angular dropdown update selection even when the parent does not store the selected value?
I have an Angular dropdown component (CustomDropdownComponent) that receives a list of options and a selected value from its parent component via @Input(). The parent also listens for selection ...
0
votes
1
answer
106
views
'FormsModule' does not appear to be an NgModule class
I am trying to import the FormsModule but i get this error
'FormsModule' does not appear to be an NgModule class.
here is my code
import { BrowserModule } from '@angular/platform-browser';
import { ...
2
votes
1
answer
2k
views
How to set up Angular Reactive Forms with Signals
I have set up a formbuilder with a number of inputs components, each of which uses a control value accessor mixin. Where I've got to is that the input components render OK, the user inputs trigger the ...
1
vote
1
answer
60
views
How to simplify Rx.js functions and have only one subscribe
I have one angular component a I want to simplify this Rx.js functions to have one only one subscribe and not have subscrition in subsribe. Is it possible? Otherwise this Rx.js has task debounce ...
2
votes
1
answer
32
views
TypeScript cannot guarantee that the controls I am accessing are of type FormGroup or FormArray in my Angular template. How to change that?
I am trying to build a LMS using Angular but I have some issues with Angular forms. I want to be able to add dynamically modules to a given course but also to add dynamically any sort of the 3 types ...
0
votes
1
answer
49
views
Angular - FormModule functionality
I'm experimenting with Angular modules, and I'm currently working with FormModule.
I noticed that once FormModule is imported into a component, the <form/> submit event no longer refreshes the ...
1
vote
1
answer
82
views
Angular unidirectional data flow and Angular Forms
I’m preparing a presentation on the topic of Angular state management for my colleagues. The main focus of the talk is creating “dumb” components which accept inputs from parent components, render ...
1
vote
1
answer
966
views
Why my reactive form doesn't work in angular 19?
I am learning angular and trying to create reactive form for user authentification. To indicate if my firm work I added {{ LoginForm.value | json }. But it seems not to work. When I type something ...
1
vote
4
answers
697
views
Should I use <form> when I use <mat-form-field> while building a Form?
I'm building a form and I'm confused if I should use mat-form-field tag from angular material alone without form tag, or I should wrapp everything with form html tag like the following
<form>
&...
0
votes
1
answer
49
views
ion datetime component persist value across different components
i have a very strange problem where i am using ion-datetime component on component inside a model component. From this component, I call another component in a model that also has an ion-datetime ...
-1
votes
1
answer
597
views
Fill form with URL parameters in Angular 19
I have a form and researching here discovered a way to check whether the form is valid or not and to put your data in the URL when submitted. However, if you open another page with the parameters in ...
1
vote
1
answer
49
views
Customize third party directive's implementation without forking
In our Angular project we are using @ngneat/error-tailor for showing form errors:
We are interested in showing the error messages when the controls are touched, feature which is requested in this ...
1
vote
1
answer
270
views
Angular 19: Implement Directive like FormControlName
I want to implement my own Property directive which should act similar to the existing FormControlName directive.
It should use the name of the given Property to act as if it where given as ...
1
vote
1
answer
223
views
Validation not updating in custom form controls using Angular's Control Value Accessor
I built a shared input component in Angular using Control Value Accessor interface. The input itself works but validation doesn't get updated when I change the value within the input. Here is the ...
0
votes
0
answers
49
views
Multiple validation is not working properly in template driven form
I having issue multiple validation is not working properly. For example validate1 method checking input is empty or not , validation2 method checking name1 and name2 value are equal or not equal. ...
0
votes
1
answer
243
views
Dynamically enable and disable a angular material input field
I try to disable and enable a angular material input field in typescript. I found only solutions where the value is set on creation time or in html like
inputField = new FormControl({ value: '', ...
1
vote
1
answer
278
views
Angular form async validator firing but not updating form validity
This is my first time trying an async form validator. It is attached at to my form's asyncValidators, it's firing appropriately, the correct value (object or null) is being returned ... but the form ...
1
vote
1
answer
483
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 ...
2
votes
1
answer
140
views
How to merge validation error of matDatepicker and parent form
I'm currently building custom month picker component using the Datepicker from angular material library.The month picker should be able to use with reactive form like this.
app.component.ts
form = ...