In My Angular Application
I made several attempts to get the values using a BehaviorSubject to know when the value was changed or received. I can not get the values before loading the component.
Through this link you can see what you are returning:
https://dev.moip.com.br/v1.5/reference#listar-planos
data.service.ts:
dataOnChanged: BehaviorSubject<any> = new BehaviorSubject({});
getData() {
    return new Promise((resolve, reject) => {
        this.http.get(this.api_URL + 'plans/, this.httpOptions).subscribe((data: any) => {
            // the result is
            // data = {plans: Array(5)}
            this.dataOnChanged.next(data);
            resolve(data);
        },
            (response: any) => {
                reject(response.error);
            });
    });
}
resolve.service.ts:
constructor(
    private dataService: DataService, {
}
* Resolve
 * @param {ActivatedRouteSnapshot} route
 * @param {RouterStateSnapshot} state
 * @returns {Observable<any> | Promise<any> | any}
 */
resolve(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<any> | Promise<any> | any {
    return new Promise((resolve, reject) => {
        Promise.all([
            this.dataService.getData()
        ]).then(
            () => {
                resolve();
            },
            reject
        );
    });
}
routes.module.ts:
        {
            path: 'home',
            component: HomeComponent,
            resolve: {
                data: ResolveService,
            },
        },
home.component.ts:
constructor(
    public data: DataService,
) {
    this.dataService.dataOnChanged.subscribe((result: any) => {
        // no result
        debugger;
    });
The problem is that I can not load the data returned by HTTP GET before loading the component. I need to load the data before and show the screen.
 
     
    