Using Angular 5. A component calls a service. This service must call another service before making a server call. I am not able to get the result asynchronously in the component. I use ellipses for brevity below.
Component:
...
import { SystemOnlineService } from '../services/system-online.service';
...
constructor(private sys: SystemOnlineService) {
sys.getStatus()
.then(result => {
console.log(result);
});
}
Run Code Online (Sandbox Code Playgroud)
SystemOnlineService:
import { Injectable } from '@angular/core';
import { Wakanda } from './wakanda.service';
import 'rxjs/add/operator/toPromise';
...
getStatus() {
this.wakanda.getCatalog()
.then((ds) => {
this.ds …Run Code Online (Sandbox Code Playgroud)