title: not able to assign an array to another array in typescript
body: <p>I have defined kitems as private kitems:any[]; in the class. However not able to assign any value to it using this.kitems = items; I am getting an empty array when I do console.log(this.kitems). </p>
  
  <pre><code>createprofile() {
      this._UserRef.on("value", function(snapshot) {
          let items = [];
          snapshot.forEach(function(childSnapshot) {
              let item = childSnapshot.val();
              item['key'] = childSnapshot.key;
              items.push(item);
          });
          console.log(items[0].key);
          this.kitems = items;
      }.bind(this));
      console.log(this.kitems);
  }
  </code></pre>