ng-dialog

create IDialogClosePromise type to be returned by closePromise.
This commit is contained in:
Mark Nadig 2015-09-23 18:16:27 -06:00
parent 32029fcb4e
commit 89eaaa5d5e
2 changed files with 15 additions and 6 deletions

View File

@ -23,6 +23,10 @@ class DialogTestController {
name: "login-popup"
});
loginDialog.closePromise.then((result) => {
var val: any = result.value;
});
if (loginDialog.id === "login-popup") {
loginDialog.close("closing");
}
@ -49,4 +53,4 @@ app.config((ngDialogProvider: angular.dialog.IDialogProvider) => {
className: "flat-ui"
})
});
});

View File

@ -26,14 +26,19 @@ declare module angular.dialog {
interface IDialogOpenResult {
id: string;
close: (value?: string) => void;
closePromise: IPromise<void>;
closePromise: IPromise<IDialogClosePromise>;
}
interface IDialogClosePromise {
id: string;
value: any;
}
interface IDialogProvider extends angular.IServiceProvider {
/**
* Default options for the dialogs.
* @param defaultOptions
* @returns {}
* @param defaultOptions
* @returns {}
*/
setDefaults(defaultOptions: IDialogOptions): void;
}
@ -44,7 +49,7 @@ declare module angular.dialog {
interface IDialogScope extends angular.IScope {
/**
* This allows you to close dialog straight from handler in a popup element.
* @param value Any value passed to this function will be attached to the object which resolves on the close promise for this dialog.
* @param value Any value passed to this function will be attached to the object which resolves on the close promise for this dialog.
* For dialogs opened with the openConfirm() method the value is used as the reject reason.
*/
closeThisDialog(value?: any): void;
@ -102,4 +107,4 @@ declare module angular.dialog {
*/
scope?: ng.IScope;
}
}
}