9
9
9karamba2019-07-22 19:34:21
Angular
9karamba, 2019-07-22 19:34:21

How to display variables after HttpClient request?

ngOnInit(){
        this.httpService.getPerson().subscribe(data => this.person=data);
        this.httpService.getEquipment().subscribe(data => this.equipment=data);        
}

I tried to get the data:
{{ person.name | async }}
outputs: TypeError: Cannot read property 'name' of undefined - that is, as I understand it, person has not yet been received by this time, it
{{ person?.name }}
displays emptiness and nothing else happens to it
-------- I
searched on the Internet, but found nothing other than these two options. How do I get the data in the template from an async call?
Please throw off books, links or write a phrase by which I can find the necessary information. Thanks in advance.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question