Issue
I am a beginner in angular firebase, I followed a training, angular firebase, I want details of a client, but it gives me in the client console: [object Object].
list-clients.component.html
<tr *ngFor="let client of clients">
<td class="text-right">
<a routerLink="/client/{{ client.id }}" class="btn btn-info "><i class="fa fa-info-circle"></i></a>
</td>
</tr>
client.service.ts
getClient(id:string){
return this.clientsCollection.doc(id).valueChanges();
}
details-client.component.ts
ngOnInit(): void {
this.id = this.route.snapshot.params['id'];
this.clientService.getClient(this.id).subscribe((client:any) => {
this.client = client;
console.log("client est : " + this.client);
});
}
Solution
In your example, the this.client property is of type Object. The console.log() method will show you the object properties if you pass the object alone instead of concatenating it to a string. You could also use your debugger and stop execution at the this.client = client line to see the value.
Answered By - tylerherzog
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.