title: Cannot read property ‘function’ of undefined
body: <p>I don't know why this code cannot run, but another way is ok</p>
  
  <pre><code>this.usersRef = this.database.ref('/doctors/' + firebase.auth().currentUser.uid + '/userList');
      this.UsersRef.on('value', function(snapshot){
         console.log(snapshot.val());
          snapshot.forEach(function (child) {
              // console.log(child.key);
              var val = child.val();
              this.displayUserInfo(child.key, val.email, val.firstname, val.lastname);
          });
      });
  </code></pre>
  
  <p>It always shows "Cannot read property ‘displayUserInfo’ of undefined",</p>
  
  <p>And this way is ok:</p>
  
  <pre><code>    var setUsersInfo = function (data) {
      var val = data.val();
      this.displayUserInfo(data.key, val.email, val.firstname, val.lastname);
  }.bind(this);
  this.usersRef.limitToLast(12).on('child_added', setUsersInfo);
  this.usersRef.limitToLast(12).on('child_changed', setUsersInfo);
  </code></pre>
  
  <p>I think the point is bind(this) in javascript, but I tried .bind(this) in the first way, and it cannot work.</p>
  
  <p>Could anyone give some hints about it? Thank you</p>