@Component({
selector: 'my-content',
templateUrl: `./app/content/content.components.html`
})
export class ContentComponent {
_clickLectre: any;
_temoobj:any;
private subscription: Subscription;
constructor(private commonService: CommonService, private dataService: DataService ) {
}
ngOnInit() {
this.subscription = this.commonService.notifyObservable$.subscribe((res) => {
if (res.hasOwnProperty('option') && res.option === 'call_Lecture') {
console.log("call"+res.items);
this._clickLectre=res.items;
console.log("call"+this._clickLectre.facultyname);
}
});
}
ngOnDestroy() {
this.subscription.unsubscribe();
}
}
html
<tr *ngIf="_clickLectre">
<td>Faculty Name : </td>
<td>{{_clickLectre.facultyname}}</td>
<td>X</td>
<td>X</td>
<td>End Time :</td>
<td>X </td>
<td> Present: </td>
<td>X </td>
</tr>
I used commonService
which use to transfer content from one Component to another Component.
above this._clickLectre.facultyname
value printed on console but it is not reflected on html page
why data binding not working what is the problem?
Thanks in advance
Since _clickLectre
is defined asynchronously you should use a safe navigation operator (?
)
<td>{{_clickLectre?.facultyname}}</td>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With