title: geting data from http.get and effecting it to an object
body: <p>when i run this code i get my desciplines array full of data</p>
  <pre><code> onGetDescs(descipline:string){
      let rep  =this.http.get(&quot;http://data&quot;);
      let result: any;
      rep.subscribe( data =&gt; {
        this.desciplines = data as Descipline[];
          result =  this.desciplines.filter(function(d) {
          return d.name === descipline;
        });
        this.desciplines = result as Descipline[];
        console.log(this.desciplines);
      });  
  
      
       return this.desciplines;
    }
  </code></pre>
  <p>but when i run i want to work with it or just to do this</p>
  <pre><code>  onGetDescs(descipline:string){
      let rep  =this.http.get(&quot;http://45.80.149.82:8080/ctp-api/api/disciplines&quot;);
      let result: any;
      rep.subscribe( data =&gt; {
        this.desciplines = data as Descipline[];
        result =  this.desciplines.filter(function(d) {
        return d.nom === descipline;
        });
        this.desciplines = result as Descipline[];
      });  
  
      console.log(this.desciplines);
  
       return this.desciplines;
    }
  </code></pre>
  <p>i get an empty array</p>
  <p>i really need to know what's happening ps: i'm new to angular</p>