title: scope of javascript variable in the class
body: <p>inside click_save() method of Controller, this is not pointing to the controller instance, but instead it points to button instance</p>
  
  <p>How to get access to this. so it points to controller and I can do this.userModelDialog().method call</p>
  
  <p>```</p>
  
  <pre><code>// --- Controller manages/dispatches tasks of view and model
  function Controller() {
    var controller = this;
    api = new API();
    var table = $('#table');
    this.userModelDialog = new UserModalDialog();
  
    $('button[data-type="edituser"]').on("click", function(e) {
      controller.click_button(this);
    });
  
    // Register the button handlers
    $.each(["save", "close", "copy", "delete", "reset"], function(index, id) {
      msg.clear();
      $("#" + id).click(controller["click_" + id]);
    });
  }
  
  
  $.extend(Controller.prototype, {
    click_user: function(id) {
      api.getUser(id)
        .done(function(data) {
          _.keys(data).forEach(function(property) {
            $('#' + property).val(data[property]);
          });
        })
        .fail(function(data) {
          alert('fail');
        });
      $('#userDetails').modal('show');
    },
    click_button: function(button) {
      var id = $(button).attr('data-id');
      this.click_user(id);
    },
    click_save: function(button) {
      this.userModelDialog.submit();
      msg.show({
        TYPE: 'success',
        MESSAGE: 'saved successfull!'
      });
      $('#userDetails').modal('hide');
  
    },
    click_new: function() {
  
    },
    click_copy: function() {
  
    },
    click_delete: function() {
  
    },
    click_reset: function() {
  
    },
    click_row: function(row) {
      var id = $(row).attr('data-uniqueid');
      this.click_user(id);
    },
    updateFromServer: function(data, callback) {
      msg.show(data);
      callback(data);
    }
  });
  </code></pre>
  
  <p>```</p>