Questions tagged [angular-formbuilder]

The FormBuilder provides syntactic sugar that shortens creating instances of a FormControl, FormGroup, or FormArray. It reduces the amount of boilerplate needed to build complex forms.

See the angular docs for more information

165 questions
3
votes
2 answers

best practice of adding a new property to a formGroup

What is the right way of adding a new object property to angular formGroup? I have this set up: ngOnInit() { this.form = this.fb.group({ // store is the formGroupname store: this.fb.group({ // branch and code are formControlName …
aRtoo
  • 891
  • 1
  • 9
  • 26
3
votes
2 answers

Angular6 - FormControlName - TypeError: Cannot read property 'get' of undefined

I have loginForm in my project Stackblitz But I get an error at 'formControlName': ERROR TypeError: Cannot read property 'get' of undefined at Object.eval [as updateDirectives] (LoginComponent.html:7) at Object.debugUpdateDirectives [as…
Slip
  • 859
  • 6
  • 17
  • 40
3
votes
4 answers

How to disable FormControl in FormArray in Angular 4

I wrote the below code snippet, which I considered as it will disable the FormControl in a FormArray. some.component.html
3
votes
0 answers

"ERROR TypeError: Cannot read property 'value' of undefined"

Please i am new to Angular and i am following a tutorial by Felipe Coury. in a chapter of the book(writing your first angular 2 web application), He uses ".value" to display the title and the link in which we are to input. for him it worked well but…
3
votes
1 answer

Mark required formControls before Validation when using Reactive Forms in Angular 5

We would like to give visual feedback to the user, which field is required, before validation, e.g. by highlighting the field blue. We are using Reactive Forms to validate the user's input: export class MyFormComponent { myForm: FormGroup; …
Florian Gössele
  • 3,423
  • 4
  • 21
  • 42
2
votes
2 answers

Angular Subscribe valuechanges in formarray in form group

I'm angular8 and I have a form array inside of form group but I want to detect new changes of a certain input. ngOnInit(): void { this.makeForm = this.fb.group({ year:['', Validators.required], amount:['',…
2
votes
2 answers

Nested dynamic form in angular - Cannot read property 'controls' of undefined

I'm trying to build a website which provides the functionality of uploading your own courses. Course Structure Name of course |-Module1 |-Lecture1 |-Lecture2 |-Module2 |-Lecture1 |-Lecture2 Using Angular I'm…
2
votes
1 answer

angular (form array) value changes is not working

Form array value changes is not working. I can't console the value inside subscriber method. Here is my basic form array code below. ordersData = [ { id: 100, name: 'order 1' }, { id: 200, name: 'order 2' }, { id: 300, name: 'order 3'…
2
votes
1 answer

How to set dynamic fields and it values in form

I'm using angular form Control. I have set of values to display in a form,few are static and few are dynamic. I'm displaying static values with formControlName and and ts file I'm receiving in fb group as below. For Known values I doing as…
anil
  • 323
  • 1
  • 3
  • 14
2
votes
2 answers

Object is possibly 'null' in email validation Angular FormControl

I get this message when I ng s --aot Object is possibly 'null'. I've been trying things all morning to fix it, any ideas? The error occurs on the Email…
artworkjpm
  • 730
  • 1
  • 10
  • 29
2
votes
0 answers

control.registerOnChange is not a function with ng-dynamic-forms and a custom form element

I am trying to use ng-dynamic-forms with a custom form element but I keep hitting that error : control.registerOnChange is not a function not sure what I am doing wrong I have made a stackblitz here…
Olivvv
  • 998
  • 1
  • 9
  • 34
2
votes
1 answer

Is it possible to make Angular ReactiveForm ValidatorFn which set error for a few seconds?

I'm trying to write ValidatorFn to check does the form's control have duplicates. I have written a validator to check it and return an error, but is it possible to remove this error after a few seconds by this validator? I know how to make it from…
2
votes
1 answer

Create a dynamic key per user Input using FormGroup Angular 8

I have a form as follows: Within the dropdown list are certain pre-defined string values. The Sensor's MAC Address input field has a Pattern check regex. Goal I wish to create an object as follows: { 'MAC_1': 'location2', 'MAC_2':…
Shan-Desai
  • 2,331
  • 1
  • 33
  • 62
2
votes
1 answer

How to validate duplicate entry in angular form builder array?

I am using angular6 reactive form with form builder and form array. I am facing problem with duplicate subject entry from drop down in form array. How to validate to avoid duplicate entry in from array. I have a subject list with drop down. When i…
2
votes
1 answer

Angular Reactive Form Array with Radio Buttons

i have problems with reactive forms and an array of radio buttons. My Form looks like this: There is a player in a row and i have to choose the status. component: {{data.firstname}}…
HansPeter
  • 239
  • 1
  • 2
  • 11
1
2
3
10 11