35 questions
3 votes
3 answers
282 views
Async pipe not working when using an observable created from a ControlValueAccessor control's valueChanges
I have a ControlValueAccesor with one FormControl. I need to create a new observable from the control's valueChanges and use it in the template via AsyncPipe. So in CVA's writeValue I update the form ...
2 votes
2 answers
248 views
Why aren't the validation errors in this custom Angular control visible from the parent component's form?
I'm working on my first custom control in Angular (16), for a Reactive Form, that contains a slider and an input. If the slider is true, then the input should have a value. If it is not, then the ...
1 vote
2 answers
999 views
Holding the state of a ControlValueAccessor component using signals requires "{ allowSignalWrites: true }"
I have this component implementing ControlValueAccessor and holding the internal state in a signal value: export class InputComponent implements ControlValueAccessor { // internal state ...
1 vote
1 answer
74 views
2 ngModel return same value when use ControlValueAccessor in Angular
I have component CustomInputComponent <div> <input #input="ngModel" name="input" [(ngModel)]="value" (ngModelChange)="onInputChange()"...
1 vote
0 answers
132 views
Rendering a dynamic form in angular using ControlValueAccessor causes ExpressionChangedAfterItHasBeenCheckedError
I would like to render an angular form dynamically, based on a json schema object that describes the fields. I would like to render multiple types of fields, but for this example I will only use text ...
1 vote
1 answer
332 views
Angular ControlValueAccessor read selectionStart and selectionEnd
I have a directive in Angular that should read it's host element's input selectionStart, selectionEnd values. I do this in my custom directive: @Directive({ selector: '[inputBehavior]', }) export ...
0 votes
0 answers
359 views
Custom dropdown search control value accessor not getting selected when i set value in form control
This is my cutom dropdown search control value accessor . issue is when i set value in form control thats not getting selected in below control @Component({ selector: 'app-dropdown-search', ...
1 vote
1 answer
438 views
How to pass form control error messages from component to child component that implements ControlValueAccessor in Angular?
For now I am using @Input() to pass error messages from parent to child component that implements ControlValueAccessor. I would like to know is there better way of passing error messages. Please guide ...
0 votes
1 answer
282 views
Angular ControlValueAccessor detect parent validator changes
When implementing a ControlValueAccessor I need to dynamically display some content based on whether or not the control is required. I know I can do this to get the control: readonly #control = ...
0 votes
1 answer
235 views
Cannot bind custom FormGroup(via ControlValueAccessor) inside FormArray
We have a 2 components. Lets call them parent and child and both of them implements ControlValueAccessor. Parent form is: this.formBuilder.group({ children: this.formBuilder.array([]) }) Child ...
3 votes
1 answer
280 views
How to <app-my-login-form #form="ngForm"> instead of #form accessing MyLoginFormComponent
PROBLEM: Produces error "No directive found with exportAs 'ngForm'" When accessing this.form in App.component.ts I would like to have an instance of the FromGroupControl instead of the ...
0 votes
2 answers
301 views
How can I modify my custom Angular form control component based on validations?
I have a custom form control where I implemented the ControlValueAccessor interface, everything is working correctly. However, I want to make a change to the component based on validations, for ...
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 ...
1 vote
1 answer
1k views
How to create custom input component with validation in Angular14?
I want to create custom component for input text but I don't know how can I bind validation of each input field to custom component. Is there any way to set errors of each field as array of objects ...
1 vote
0 answers
64 views
How to set validation in wrapper of input in Angular?
I want to create custom component for input text but I don't know how can I bind validation of each input field to custom component. Is there any way to set errors of each field as array of objects ...