I have a component where I select a set of image objects. I want to pass these selected images to my new route, CreateAlbum. The data it nested and wouldn\'t be suitable to
You can pass data using router, for example
{ path: 'form', component: FormComponent ,data :{data :'Test Data'} },
and your component
import { ActivatedRoute, Router } from '@angular/router';
export class FormComponent {
sub: any;
constructor(private route: ActivatedRoute) { }
ngOnInit() {
this.sub = this.route
.data
.subscribe(value => console.log(value));
}
}
More info
But this may not be the preferred way, you can use parent child communication or make a service common and share data between them. Check below references for doing that.
Parent child communication
Share data using service