function openPanel(preset, opt_config) {
    // TODO(ErinCoughlan): Investigate why panelRef.open() doesn't return
    // panelRef.
    var openPromise;

    if (panelRef) {
      openPromise = panelRef.open();
    } else {
      openPromise = $mdPanel.open(preset, opt_config);
    }

    openPromise.then(function(createdPanelRef) {
      panelRef = createdPanelRef;
      return panelRef;
    });

    flushPanel();
  }
Opens the panel. If a config value is passed, creates a new panelRef
using $mdPanel.open(config); Otherwise, called open on the panelRef,
assuming one has already been created.
@param {!Object=} opt_config