Modals - m-kostira/angularjs-notes GitHub Wiki

Modal

Example confirmation dialog:

c8yModal({
              title: 'Confirm delete?',
              body: 'Do you really want to remove this managed object?'
            })
            .then(()=>{
                console.log('confirmed);
            }).catch(() => {
                console.log('cancelled');
            });

http://resources.cumulocity.com/documentation/jssdk/latest/#/api/c8y.ui.service:c8yModal http://angular-ui.github.io/bootstrap/#!#modal

The component parameter (Type: string, Example: myComponent) - A string reference to the component to be rendered that is registered with Angular's compiler. If using a directive, the directive must have restrict: 'E' and a template or templateUrl set.

It supports these bindings(with the & binding!):

close - A method that can be used to close a modal, passing a result. The result must be passed in this format: {$value: myResult}

dismiss - A method that can be used to dismiss a modal, passing a result. The result must be passed in this format: {$value: myRejectedResult}

modalInstance - The modal instance. This is the same $uibModalInstance injectable found when using controller.

resolve - An object of the modal resolve values. See UI Router resolves for details.

 function popupAddIODDModal() {
      return c8yModal({ component: 'a5nAddIODDModal' })
        .then(addIODD)
        .then(() => c8yAlert.success(gettextCatalog.getString('IODD added.')));
    }