Me again...

Now, I've tried this without the form builder, but I'm getting an error in 
the ngOnInit:

@Input() addToGroup: FormGroup;
constructor() { }

incidentHeader = new FormGroup({
date: new FormControl(''),
lastUpdated: new FormControl(''),  
id: new FormControl(''),
reoccurring:new FormControl(''),
status: new FormControl(''),
priority: new FormControl(''),
countriesImpacted: new FormControl(''),
bridge: new FormControl(''),
service: new FormControl(''),
pdl: new FormControl(''),
optDates: new FormControl('')
})

ngOnInit() {
this.addToGroup('incidentHeader',)
}

When I try to add this.incidentHeader to the 2nd argument - it says:

*"Cannot invoke an expression whose type lacks a call signature."*


On Monday, August 27, 2018 at 10:26:26 AM UTC-5, daniel....@gmail.com wrote:
>
> Thanks for the assistance - I will try this out.
> I have to revert back to the original way of adding form groups, to make 
> this work, I think.
>
> How does this work with a form builder, however?
>
> constructor(private fb: FormBuilder) { }
>
> incidentHeader = this.fb.group({
>
> date: [''],
> lastUpdated: [''],   
> id: [''],
> reoccurring: [''],
> status: [''],
> priority: [''],
> countriesImpacted: [''],
> bridge: [''],
> service: [''],
> pdl: [''],
> optDates: ['']
> })
>
> On Friday, August 24, 2018 at 1:07:08 AM UTC-5, Sander Elias wrote:
>>
>> Hi Daniel,
>>
>> <form [formGroup]="mainForm">
>>   <HeaderData [addToGroup]="mainForm"></HeaderData>
>>   <IncidentData></IncidentData>
>>   <AnalysisData></AnalysisData></form>
>>
>> in your data components:
>>
>> @Input() addToGroup:FormGroup
>>
>> ngOnOninit() {
>>   this.addToGroup('someName',formGroupForThisComponent)
>> }
>>
>> Is this enough to get you going?
>> Regards
>> Sander
>> ​
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to