title: how to resolve the ''cannot read property 'property-name' of null?
body: <p>I am trying to retrieve all the data from firebase database into an array in typescript. Here is the relevant code snippet :</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>export class ViewUserPage {
    public list = [];
    public ref = firebase.database().ref();
    public usersRef = this.ref.child('users');
  
    constructor(public navCtrl: NavController, public navParams: NavParams) {}
    
    ionViewDidLoad(){
    
    this.usersRef.orderByChild('tag').equalTo('staff').on('child_added',function(snap){
      this.list.push(snap.val());console.log(snap.val());
      });
  
  }
  
     
  
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>The error I'm getting is this "Cannot read property 'list' of null". I think it is occurring in the </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>this.usersRef.orderByChild('tag').equalTo('staff').on('child_added',function(snap){
      this.list.push(snap.val());console.log(snap.val());</code></pre>
  </div>
  </div>
  </p>
  
  <p>part. This is the full error:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>ERROR TypeError: Cannot read property 'list' of null
      at main.js:59030
      at main.js:30999
      at fc (main.js:30861)
      at bf (main.js:30926)
      at cf (main.js:30925)
      at Qg.g.Gb (main.js:31016)
      at Ag.g.wd (main.js:30980)
      at og.wd (main.js:30970)
      at Yf.Xf (main.js:30968)
      at ag (main.js:30952)
  defaultErrorLogger @ main.js:1436 </code></pre>
  </div>
  </div>
  </p>
  
  <p>How to go about this ? Please help !</p>