title: Using value returned from service in component Angular 4
body: <p>I am working on an Angular4 application where I want to access data in a component I request threw 2 services.
  When I execute the code in this state the service-call inside my component is not returning any data. When I tried to console.log the value of my service-call the line does not get executed at all.</p>
  
  <p>So my question is, why don't I get a return value from my service function?</p>
  
  <p>I tested the service and it receives the data from my GET-Request.</p>
  
  <p>Can someone help me to get my data into my local variable inside my component and explain to me how it works?</p>
  
  <p>I am pretty new to angular and appreciate any advice of how to improve my code.</p>
  
  <p>Thanks in advance.</p>
  
  <h2>The component I want to access the data with</h2>
  
  <pre><code>   export class ComponentA implements OnInit {
    public skills: Skill[];
  
    ngOnInit() {
      this.getColleagueSkills(3);
    }
  
    getColleagueSkills(colleague_id: number) {
      console.log('function');
      debugger;
      this.skills = this.skillService.getSkillsForColleague(colleague_id);
      console.log('after function');
    }
  }
  </code></pre>
  
  <h2>The first service I call to get the data from</h2>
  
  <pre><code>@Injectable()
  export class SkillsService {
    private SkillUrl = ...;
    private RatingUrl = ...;
  
    constructor(private http: Http, private colleagueService: ColleagueService) {
    }
  
  
  
  getSkillsForColleague(colleague_id: number) : Skill[]{
      let ratedSkillsForColleague = [];
      let colleagueRating = [];
      let colleague: Colleague;
      this.colleagueService.getColleague(colleague_id).subscribe(
        data =&gt; { colleague = data},
        error =&gt; {},
        () =&gt; {
          colleagueRating = colleague.coll_rating;
            for ( let r in colleagueRating){
              ratedSkillsForColleague[r] = colleagueRating[r].rating_skill;
            }
            return ratedSkillsForColleague;
        }
      )
      return ratedSkillsForColleague;
    }
  </code></pre>
  
  <h2>The service I call within the service</h2>
  
  <pre><code>@Injectable()
  export class ColleagueService {
  
    private ColleagueUrl = ...;
    constructor(private http: Http) { }
  
  
    getColleague(id: number){
      const url = `${this.ColleagueUrl}${id}`
      return this.http.get(url).map(
        response =&gt; response.json()).catch(this.handleError);
    }
  </code></pre>