I have three classes A, B and C like this:
class A{
id: number;
name: string;
//... more
items: B[];
}
class B{
id: number;
name: string;
//... more
otherItems: C[];
}
class C{
id: number;
name: string;
}
A, B and C have their own service to get the data by id from http request but the data comes like
class A{
id: number;
name: string;
...
items: number[]; //ids of B items
}
class B{
id: number;
name: string;
...
otherItems: number[]; //ids of C items
}
class C{
id: number;
name: string;
...
}
Some behavior of A depends on C items so I have three components (AComponent
, BComponent
and CComponent
) with 'id' input and I'm using @ViewChildren on parent component, combined with some get/set functions to get the info needed, but I don't think that I'm going the best way
I thought about to do a resolver to get full A data before start, but it's a mess with so many promises.
Which way do you think is a better solution? Any other idea?