Types - MdPanelRef

MdPanelRef API Documentation

A reference to a created panel. This reference contains a unique id for the panel, along with the following properties:

  • id - {string}: The unique id for the panel. This id is used to track when a panel was interacted with.
  • config - {!Object=}: The entire config object that was used in create.
  • isAttached - {boolean}: Whether the panel is attached to the DOM. Visibility to the user does not factor into isAttached.
  • panelContainer - {JQLite}: The wrapper element containing the panel. This property is added in order to have access to the addClass, removeClass, toggleClass, etc methods.
  • panelEl - {JQLite}: The panel element. This property is added in order to have access to the addClass, removeClass, toggleClass, etc methods.

Methods


  • MdPanelRef.open();

    Attaches and shows the panel.

    Returns Description
    Q.IPromise

    A promise that is resolved when the panel is opened.

  • MdPanelRef.close();

    Hides and detaches the panel. Note that this will not destroy the panel. If you don't intend on using the panel again, call the destroy method afterwards.

    Returns Description
    Q.IPromise

    A promise that is resolved when the panel is closed.

  • MdPanelRef.attach();

    Create the panel elements and attach them to the DOM. The panel will be hidden by default.

    Returns Description
    Q.IPromise

    A promise that is resolved when the panel is attached.

  • MdPanelRef.detach();

    Removes the panel from the DOM. This will NOT hide the panel before removing it.

    Returns Description
    Q.IPromise

    A promise that is resolved when the panel is detached.

  • MdPanelRef.show();

    Shows the panel.

    Returns Description
    Q.IPromise

    A promise that is resolved when the panel has shown and animations are completed.

  • MdPanelRef.hide();

    Hides the panel.

    Returns Description
    Q.IPromise

    A promise that is resolved when the panel has hidden and animations are completed.

  • MdPanelRef.destroy();

    Destroys the panel. The panel cannot be opened again after this is called.

  • MdPanelRef.addClass(newClass, toElement);

    Adds a class to the panel. DO NOT use this hide/show the panel.

    Parameter Type Description
    * newClass string string

    class to be added.

    * toElement boolean boolean

    Whether or not to add the class to the panel element instead of the container.

  • MdPanelRef.removeClass(oldClass, fromElement);

    Removes a class from the panel. DO NOT use this to hide/show the panel.

    Parameter Type Description
    * oldClass string string

    Class to be removed.

    * fromElement boolean boolean

    Whether or not to remove the class from the panel element instead of the container.

  • MdPanelRef.toggleClass(toggleClass, onElement);

    Toggles a class on the panel. DO NOT use this to hide/show the panel.

    Parameter Type Description
    * toggleClass string string

    Class to be toggled.

    * onElement boolean boolean

    Whether or not to remove the class from the panel element instead of the container.

  • MdPanelRef.updatePosition(position);

    Updates the position configuration of a panel. Use this to update the position of a panel that is open, without having to close and re-open the panel.

    Parameter Type Description
    * position MdPanelPosition MdPanelPosition
  • MdPanelRef.addToGroup(groupName);

    Adds a panel to a group if the panel does not exist within the group already. A panel can only exist within a single group.

    Parameter Type Description
    * groupName string string

    The name of the group to add the panel to.

  • MdPanelRef.removeFromGroup(groupName);

    Removes a panel from a group if the panel exists within that group. The group must be created ahead of time.

    Parameter Type Description
    * groupName string string

    The name of the group.

  • MdPanelRef.registerInterceptor(type, callback);

    Registers an interceptor with the panel. The callback should return a promise, which will allow the action to continue when it gets resolved, or will prevent an action if it is rejected. The interceptors are called sequentially and it reverse order. type must be one of the following values available on $mdPanel.interceptorTypes:

    • CLOSE - Gets called before the panel begins closing.
    Parameter Type Description
    * type string string

    Type of interceptor.

    * callback !Q.IPromise<any> !Q.IPromise<any>

    Callback to be registered.

    Returns Description
    MdPanelRef
  • MdPanelRef.removeInterceptor(type, callback);

    Removes a registered interceptor.

    Parameter Type Description
    * type string string

    Type of interceptor to be removed.

    * callback function(): !Q.IPromise<any> function(): !Q.IPromise<any>

    Interceptor to be removed.

    Returns Description
    MdPanelRef
  • MdPanelRef.removeAllInterceptors([type]);

    Removes all interceptors. If a type is supplied, only the interceptors of that type will be cleared.

    Parameter Type Description
    type string string

    Type of interceptors to be removed.

    Returns Description
    MdPanelRef
  • MdPanelRef.updateAnimation(animation);

    Updates the animation configuration for a panel. You can use this to change the panel's animation without having to re-create it.

    Parameter Type Description
    * animation MdPanelAnimation MdPanelAnimation