How To
Documentation
    Learn More

      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'); </code></pre></div></div> </div> </li> <li><h3 id="methods_register">register(modal)</h3> <div class="register"><div class="lightning-modalservice-register-page"><p>Registers the modal to the factory</p> </div><h5 id="methods_register_parameters">Parameters</h5><table class="variables-matrix table table-bordered table-striped"><thead><tr><th>Param</th><th>Type</th><th>Details</th></tr></thead><tbody><tr><td>modal</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="lightning-modalservice-register-page"><p>The modal object.</p> </div></td></tr></tbody></table><h4 id="methods_register_example">Example</h4> <div class="example"><div class="lightning-modalservice-register-page"><p>ModalService.register(modal);</p> </div></div> </div> </li> <li><h3 id="methods_show">show(name)</h3> <div class="show"><div class="lightning-modalservice-show-page"><p>Shows the modal in the view.</p> </div><h5 id="methods_show_parameters">Parameters</h5><table class="variables-matrix table table-bordered table-striped"><thead><tr><th>Param</th><th>Type</th><th>Details</th></tr></thead><tbody><tr><td>name</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="lightning-modalservice-show-page"><p>The ID of the modal to remove.</p> </div></td></tr></tbody></table><h4 id="methods_show_example">Example</h4> <div class="example"><div class="lightning-modalservice-show-page"><p>ModalService.show(name);</p> </div></div> </div> </li> <li><h3 id="methods_unregister">unregister(name)</h3> <div class="unregister"><div class="lightning-modalservice-unregister-page"><p>Un-registers the modal removing it from the view and the factory.</p> </div><h5 id="methods_unregister_parameters">Parameters</h5><table class="variables-matrix table table-bordered table-striped"><thead><tr><th>Param</th><th>Type</th><th>Details</th></tr></thead><tbody><tr><td>name</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="lightning-modalservice-unregister-page"><p>The ID of the modal to remove.</p> </div></td></tr></tbody></table><h4 id="methods_unregister_example">Example</h4> <div class="example"><div class="lightning-modalservice-unregister-page"><p>ModalService.unregister(name);</p> </div></div> </div> </li> </ul> </div> </div>