title: Uncaught (in promise): TypeError: Cannot set property 'other_user_image' of undefined
body: <p>I am trying to set the image src attribute using a typescript function but getting "cannot set property of undefined error" again and again. I don't understand where I am doing it wrong.</p>
  
  <p>html code:</p>
  
  <pre class="lang-html prettyprint-override"><code>&lt;div class="panel-heading" style="border-bottom: 1px solid #cfdbe2; padding: 14px 15px;"&gt;
      &lt;div class="pull-left"&gt;
          &lt;img class="media-box-object img-circle thumb32" src="{{other_user_image}}" alt="Image" /&gt;
      &lt;/div&gt;
      &lt;div class="panel-title"&gt;User&lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>component.ts code:</p>
  
  <pre><code>export class ChatComponent implements OnInit {
      other_user_image: string;
  
      constructor(
          public authService: AuthService,
          afAuth: AngularFireAuth,
          public db: AngularFirestore,
          private router: Router) {}
  
      ngOnInit() {
      }
  
      openChatWindow(event: any){
          var target = event.target || event.srcElement || event.currentTarget;
          var idAttr = target.attributes.id;
          var value = idAttr.nodeValue;
          // var elem_id = (this.elem);
          console.log(value);
          var user_chat_room = this.db.collection("users").doc(value)
          console.log(user_chat_room);
          user_chat_room.ref.get().then(function(documentSnapshot) {
              console.log(documentSnapshot.data());
              if (documentSnapshot.exists) {
                  console.log('doneeeeeeee');
                  console.log(documentSnapshot.data()['profileImageUrl']);
  
                  this.other_user_image = documentSnapshot.data()['profileImageUrl'];
                  console.log(this.other_user_image);
              } else {
                  // doc.data() will be undefined in this case
                  console.log("No such document!");
              }
          });
      }
  }
  </code></pre>
  
  <p>While printing <code>documentSnapshot.data()['profileImageUrl']</code>, I am getting a string like this <code>http://qualiscare.com/wp-content/uploads/2017/08/default-user.png</code> but I am unable to assign it to the image <code>src</code> attribute.</p>