i'm attempting to retrieve object data from one component and pass it to another using queryParams. I've noticed that when passing a string or number, everything works correctly. However, when trying to pass an object or array, all I get is [Object Object]
this is the component where I want to receive the data
constructor(private route: ActivatedRoute) { }
ngOnInit(): void {
this.route.queryParams
.subscribe((params: any) =>{
console.log(params)
})
}
}
and this is the component where I want to pass the data from
constructor(... private route: Router) { }
showFull(song: any) {
console.log(song)
this.route.navigate(['song'], { queryParams:{ song } } )
}
and this is its template
<div class="songs">
<div (click)="showFull(song)" *ngFor="let song of filteredSongs let i = index" class="song">
...
</div>
</div>
i'm trying to get object data from one component to another, using queryParams. when i pass string or number it works but when i try to pass object or array i get [Object Object]