How to wait a graphql query is finished using apollo?

I have the following code :

ngOnInit() { = this.apollo.query({ query: ResidentQuery }).subscribe(({data, loading}) => { = data;
  this.loading = loading;

if (!this.loading) {
  // using

I want data to be loaded before processed them after the (!this.loading). It is not the case as loading is asynchronous. How I can wait the data is loaded before using them ?

I am making a graphql query using apollo client. ResidentQuery is a string containing the graphql query.

Thank you for your feedbacks !