Description

Twigkit service for registering and un-registering modals

Methods

close(name)

Hides the modal in the view.

Parameters

ParamTypeDetails
namestringThe 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
namestringThe name of the modal, if null the callback will fire whenever a modal is closed
callbackFunctionThe function to be called when the cancel event is fired.
scopeObjectThe $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
modalstringThe modal object.

Example

ModalService.register(modal);

show(name)

Shows the modal in the view.

Parameters

ParamTypeDetails
namestringThe 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
namestringThe ID of the modal to remove.

Example

ModalService.unregister(name);