When I pass the value to child component values coming in template but not showing in ngOnInit of child component
parent Component
<div class="overview bg-blue-pattern">prospectId {{prospectId}}
<app-calls-log-history [prospectid]="prospectId"></app-calls-log-history>
</div>
Child Componnet
<div class="calls-log-history-container">
prospectId {{prospectid}}
</div>
Child component ts file
import { Component, OnInit,Input } from '@angular/core';
import { ContactFilterService } from '../../../../services/contact.service';
@Component({
selector: 'app-calls-log-history',
templateUrl: './calls-log-history.component.html',
styleUrls: ['./calls-log-history.component.scss']
})
export class CallsLogHistoryComponent implements OnInit {
@Input() prospectid: any;
CallsLogHistory: Array<any> = [];
constructor( private _contactFilterService: ContactFilterService) { }
ngOnInit() {
console.log('prospectid : '+ this.prospectid); // coming as undefined
this._contactFilterService.getCallsLogHistory(this.prospectid).subscribe(
result => {
this.CallsLogHistory = result.notes;
}
);
}
}