Parent.component.html
<app-child [activeUser]="activeUser" *ngIf="eceConfirm && activeUser"></app-child>
Parent.component.ts In ngOnInit I called getAllEmployees to get all the employee data and passed 0th index data to the child component using @Input() activeUser.
getAllEmployees() {
this.service
.getCommonEmployeesDetail(this.user["uid"], this.selectedRatingCycleId)
.subscribe((res) => {
this.userList = res;
this.changeUser(this.userList[0]);
});
}
changeUser(user) {
console.log("user", user);
this.activeUser=user;
}
Child.component.ts
I have implemented changeDetection.Onpush strategy in my child component. After getting my activeUser data I am passing it in the changeChildUser() method to fetch data from a request and assigning it to the this.cycleData.
The problem which I am facing 1.When I try to print {{cycleData.Englishmarks}} in HTML page doesn't get refreshed. I consoled this.cycleData and it was displaying the value in the console.
Any idea what might be the problem.Any input is appreciated.Thanks in advance
@Input() activeUser: BpuData;
ngOnChanges(changes: SimpleChanges) {
this.changeChildUser();
}
changeChildUser() {
this.chapterService.getcycle(this.activeUser).subscribe(response =>{
this.cycleData=response;
});
}