Subscribe Observable value
<p>When I'm logging the value of my variable inside the subscribe i have a value but when doing it outside it i get undefined ???:</p>

<pre><code>this._postService.getConf("app/conf/conf.json")
   .subscribe(res =&gt;{
      this.home = JSON.stringify(res);
      console.log("value :" + this.home);
</code></pre>

<p>i want to initialize my home variable with a certain value I'm doing it on ngOnInit but it get the value undefined when I'm trying to get it outside:</p>

<p>This is my function : </p>

<pre><code>getConf(url) {
   return this._http.get(url).
      map(res =&gt; {return res.json()});
}

ngOnInit() {

  this._postService.getConf("app/conf/conf.json")
   .subscribe(res =&gt; {
        this.home = JSON.stringify(res);
        console.log("hahowaaaaaaaa" + this.home);
   }
  );

  this._postService.getPosts(this.home)
  .subscribe(result =&gt;{ 
    this.loading = false;
    this.actionsG = result; 
    var count = JSON.stringify(result);

    this.aCount = count.substring(count.indexOf(','),23);

  },error=&gt; console.error('Error: ' + error), ()=&gt; console.log('finish! ActionsG'));

  this._postService.getPosts(this.home ).subscribe(result =&gt; this.actionsV = 
    result, error=&gt; console.error('Error: ' + error), ()=&gt; console.log('finish! ActionsV ngOnInit' + this.page));
}
</code></pre>