title: Ionic: Get data from subscribe
body: <p>I am trying to get the data inside the subscribe. When I console log it inside the subscribe, the data is available. 
  But when I try to store the data to a variable and console log it outside the subscribe, the data is undefined.</p>
  
  <p>How can I get the result from the subscribe and store it in a variable?</p>
  
  <p>I'm new to ionic and angular. :)
  Thanks.</p>
  
  <pre><code>@Injectable()
  export class UserServiceProvider {
  
      users: any;
  
  constructor(public http: Http) {
  
  }
  
  loadUsers() {
     this.http.get("https://randomuser.me/api/?results=1")
              .map(res =&gt; res.json())
              .subscribe(data =&gt; {
                  //works fine
                  console.log(data.results);
  
                  this.users = data.results
              });
  
      //the variable is undefined.
      console.log(this.users);
    }
  }
  </code></pre>