diff --git a/angular-ui-bootstrap/angular-ui-bootstrap-tests.ts b/angular-ui-bootstrap/angular-ui-bootstrap-tests.ts index 8ed8be859e..608591b581 100644 --- a/angular-ui-bootstrap/angular-ui-bootstrap-tests.ts +++ b/angular-ui-bootstrap/angular-ui-bootstrap-tests.ts @@ -118,7 +118,7 @@ testApp.config(( }); testApp.controller('TestCtrl', ( - $scope: ng.IScope, + $scope: ng.ui.bootstrap.IModalScope, $log: ng.ILogService, $modal: ng.ui.bootstrap.IModalService, $modalStack: ng.ui.bootstrap.IModalStackService, @@ -147,9 +147,9 @@ testApp.controller('TestCtrl', ( $log.log('modal opened'); }); - modalInstance.result.then(closeResult=> { + modalInstance.result.then((closeResult:any)=> { $log.log('modal closed', closeResult); - }, dismissResult=> { + }, (dismissResult:any)=> { $log.log('modal dismissed', dismissResult); }); diff --git a/angular-ui-bootstrap/angular-ui-bootstrap.d.ts b/angular-ui-bootstrap/angular-ui-bootstrap.d.ts index 2d792d1b16..ad90dc9db1 100644 --- a/angular-ui-bootstrap/angular-ui-bootstrap.d.ts +++ b/angular-ui-bootstrap/angular-ui-bootstrap.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Angular UI Bootstrap 0.10.0 +// Type definitions for Angular UI Bootstrap 0.11.0 // Project: https://github.com/angular-ui/bootstrap // Definitions by: Brian Surowiec // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -198,6 +198,22 @@ declare module ng.ui.bootstrap { opened: ng.IPromise; } + interface IModalScope extends ng.IScope { + /** + * Those methods make it easy to close a modal window without a need to create a dedicated controller + */ + + /** + * Dismiss the dialog without assigning a value to the promise output + */ + $dismiss(reason?: any): void; + + /** + * Close the dialog resolving the promise to the given value + */ + $close(result?: any): void; + } + interface IModalSettings { /** * a path to a template representing modal's content @@ -211,9 +227,9 @@ declare module ng.ui.bootstrap { /** * a scope instance to be used for the modal's content (actually the $modal service is going to create a child scope of a provided scope). - * Defaults to `$rootScope` + * Defaults to `$rootScope`. */ - scope?: any; + scope?: IModalScope; /** * a controller for a modal instance - it can initialize scope used by modal. @@ -246,6 +262,16 @@ declare module ng.ui.bootstrap { * additional CSS class(es) to be added to a modal window template */ windowClass?: string; + + /** + * optional size of modal window. Allowed values: 'sm' (small) or 'lg' (large). Requires Bootstrap 3.1.0 or later + */ + size?: string; + + /** + * a path to a template overriding modal's window template + */ + windowTemplateUrl?: string; } interface IModalStackService {