title: How to Assign subscribe data in Angular 2 constructor?
body: <p>I am learning Angular 2 , I need to assign the result of my service to the data variable in the constructor of my component.
  How can I use the subscribe data in the constructor and assign this values to my public data array?</p>
  
  <pre><code>public data: Array&lt;any&gt; =[];
  
  public constructor(private _languageService: LanguageService){
  
      this._languageService.getLanguages()
      .subscribe(languages =&gt; {this.languages =languages;}
          ,error =&gt; this.errorMessage = &lt;any&gt;error)
  
      this.length = this.data.length;
      //How i can set  this.data = this.languages  
      //if  this.languages is empty outside the subscribe?
  }
  </code></pre>
  
  <p>I really appreciate if someone can explain to me how to assign the data returned by the service to a variable.</p>