title: cannot read property push of 'undefined'
body: <pre><code>app.controller('ctrl', function($scope){
      var socket = io.connect();
  
      this.messages = [];
  
      this.sendMessage = function(){
          socket.emit('new message', this.input_message);
          this.input_message = '';
      }
  
      socket.on('new message', function(data){
          this.messages.push(data);
      });
  });
  </code></pre>
  
  <p>I am getting the data emitted by the socket, but when I try to push that data into the <code>messages</code> array, it shows the error <code>cannot read the property push of undefined</code>. What wrong am I doing?</p>