I have a path 'user/edit' to edit to current logged in user. I have an tab that i want to edit an array of 'Recipe'-s that every user has. I am getting the data about the user with a resolver. And i am getting all his Recipes. The problem is that every recipe has an array of 'Photo'-s, and this array for every 'Recipe' is null. How i can these data?
This is my Resolver
export class UserDetailResolver implements Resolve<User> {
constructor(private userService: UserService, private router: Router,
private authService: AuthService, private notif: NgxNotificationService )
{}
resolve(route: ActivatedRouteSnapshot): Observable<User> {
return this.userService.getUser(this.authService.decodedToken.nameid).pipe(
catchError(error => {
this.notif.sendMessage('Problem retrieving data', 'warning', 'bottom-right');
this.router.navigate(['/users']);
return of(null);
})
);
}
}
user-edit.component:
export class UserEditComponent implements OnInit {
user: User;
recipes: Recipe[];
constructor(private route: ActivatedRoute) { }
ngOnInit() {
this.route.data.subscribe(data => {
this.user = data['user'];
});
In other section of my app i have no problem to Show all Recipes with their photos, and made a gallery and everything is fine. May be i should use second resolver to resolve every recipe in the array, but i can do that?