Product Selector

Fusion 5.12
    Fusion 5.12

    ModalService

    Description

    Twigkit service for registering and un-registering modals

    Methods

    • close(name)

      Hides the modal in the view.

      Parameters
      ParamTypeDetails
      namestring

      The ID of the modal to remove.

      Example

      ModalService.close(name);

    • onClose(name, callback, scope)

      When the modal's close event is fired the callback function will be called.

      Parameters
      ParamTypeDetails
      namestring

      The name of the modal, if null the callback will fire whenever a modal is closed

      callbackFunction

      The function to be called when the cancel event is fired.

      scopeObject

      The $scope object for unsubscribing to the event when the scope is destroyed.

      Example

      ModalService.onClose('MyModal', function (modalId) {
       console.log('Modal: 'modalId + ' has been closed');
      }, $scope);
      ModalService.close('my_modal');
      
    • register(modal)

      Registers the modal to the factory

      Parameters
      ParamTypeDetails
      modalstring

      The modal object.

      Example

      ModalService.register(modal);

    • show(name)

      Shows the modal in the view.

      Parameters
      ParamTypeDetails
      namestring

      The ID of the modal to remove.

      Example

      ModalService.show(name);

    • unregister(name)

      Un-registers the modal removing it from the view and the factory.

      Parameters
      ParamTypeDetails
      namestring

      The ID of the modal to remove.

      Example

      ModalService.unregister(name);