import { Component, Input, OnInit } from '@angular/core';
import { FormGroup, AbstractControl } from '@angular/forms';
import { FamilleCouple } from 'src/app/FamilleCouple';
@Component({
selector: 'app-marie',
templateUrl: './marie.component.html',
styleUrls: ['./marie.component.css'],
})
export class ChildComponent implements OnInit {
x = 5;
constructor() {}
ngOnInit() {}
}
@Component({
selector: 'app-condidature',
templateUrl: './condidature.component.html',
styleUrls: ['./condidature.component.css'],
providers: [],
})
export class ParentComponent implements OnInit {
@ViewChild(MarieComponent) x!: ChildComponent;
}
I can't get the value of x from the child component in the Parent Component??
How to pass data from the child Component to the parent component using @ViewChild. Console :