How to solve the first element of a resulect list in a parent state in a child state?

0

Good day.

I have a parent state in which I resolve a list, this is loaded by an http request.

This parent state has a child who must solve the first element of the parent list.

How could I solve this situation? Thank you in advance

    
asked by devjav 25.04.2018 в 23:21
source

2 answers

0

You could try using the parent property of route as follows in the children:

ngOnInit() {
this.route.parent.data.subscribe(data => {
    this.project = data.residents;
});
    
answered by 25.04.2018 в 23:53
0

I solved it by loading the resolver data of the parent state in the son resolve service

@Injectable() export class OnlyUserResolve implements Resolve<User>{ resolve(route: ActivatedRouteSnapshot) { return route.parent.data.users[0];}}
    
answered by 26.04.2018 в 00:04