hi all i have a 2 of same level component in my main component , one of my sibling component have a form and i need to collect that form data from another sibling component
<tab [tabTitle]="'Quote'"> <div #quotedetails></div> </tab>
#quotedetails
- this load from dynamic used ComponentFactoryResolver
, this include the form with data
here is my form
<form [formGroup]="policyForm">
<input type="text" class="form-control" formControlName="PostCode" placeholder="Post Code" />
</form >
and use FormBuilder for build controller in my component side
policyForm: FormGroup;
constructor(private fb: FormBuilder) {
this.policyForm = this.fb.group({
PostCode : this.fb.control(null),
}),
}
here is how i render dynamic component in my main component
@ViewChild('quotedetails', { read: ViewContainerRef }) target: ViewContainerRef;
private componentRef: ComponentRef<any>;
private children = {
LHI: LHIComponent,
Test: TestComponent
};
ngAfterContentInit() {
let childComponent = this.children['LHI'];
let componentFactory = this.compiler.resolveComponentFactory(childComponent);
this.componentRef = this.target.createComponent(componentFactory);
}
constructor(private policyService: PolicyService, private compiler: ComponentFactoryResolver) {
}
this is sibling view
<quote-summary [policyDetail]="policyDetail" [summary]="summary" ></quote-summary>
so i need to assess the form in 'quote-summary' component