In my project, I am facing an issue with passing the formGroup from a child component to a parent component.
Here is how I attempted to solve this problem:
Child Component:
@Output() formGroup = new EventEmitter<Categoria>();
In my constructor and createFormGroup function:
constructor() {this.formGroup = createFormGroup()}
let createFormGroup = (dataItem?: CategoriaIcone) => {
if (dataItem) {
return new FormGroup({
'NomeImagem': new FormControl(dataItem.NomeImagem), //name of the image
'UrlImagemIcone': new FormControl(dataItem.UrlImagemIcone),
'Imagem': new FormControl(''),
'TypeImage': new FormControl('')
});
} else {
return new FormGroup({
'NomeImagem': new FormControl(''),
'UrlImagemIcone': new FormControl(''),
'Imagem': new FormControl(''),
'TypeImage': new FormControl('')
});
}
}
However, I encountered an error in the constructor:
Type 'FormGroup' is missing the following properties from type 'EventEmitter': __isAsync, emit, subscribe, observers, and 17 more.