Skip to content

Commit

Permalink
angular-ui-bootstrap: add missing $modalStack service
Browse files Browse the repository at this point in the history
  • Loading branch information
xt0rted committed Jan 14, 2014
1 parent 2bd91a1 commit 91904e9
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
14 changes: 13 additions & 1 deletion angular-ui-bootstrap/angular-ui-bootstrap-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,12 @@ testApp.controller('TestCtrl', (
$scope: ng.IScope,
$log: ng.ILogService,
$modal: ng.ui.bootstrap.IModalService,
$modalStack: ng.ui.bootstrap.IModalStackService,
$position: ng.ui.bootstrap.IPositionService,
$transition: ng.ui.bootstrap.ITransitionService)=> {

/**
* test the $modal instance
* test the $modal service
*/
var modalInstance = $modal.open({
backdrop: 'static',
Expand Down Expand Up @@ -153,6 +154,17 @@ testApp.controller('TestCtrl', (
});


/**
* test the $modalStack service
*/
$modalStack.open(modalInstance, { scope: $scope });
$modalStack.close(modalInstance);
$modalStack.close(modalInstance, 'with reason');
$modalStack.dismiss(modalInstance);
$modalStack.dismiss(modalInstance, 'with reason');
$modalStack.getTop().key.close();


/**
* test the $position service
*/
Expand Down
27 changes: 27 additions & 0 deletions angular-ui-bootstrap/angular-ui-bootstrap.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,33 @@ declare module ng.ui.bootstrap {
windowClass?: string;
}

interface IModalStackService {
/**
* Opens a new modal instance.
*/
open(modalInstance: IModalServiceInstance, modal: any): void;

/**
* Closes a modal instance with an optional result.
*/
close(modalInstance: IModalServiceInstance, result?: any): void;

/**
* Dismisses a modal instance with an optional reason.
*/
dismiss(modalInstance: IModalServiceInstance, reason?: any): void;

/**
* Gets the topmost modal instance that is open.
*/
getTop(): IModalStackedMapKeyValuePair;
}

interface IModalStackedMapKeyValuePair {
key: IModalServiceInstance;
value: any;
}


interface IPaginationConfig {
/**
Expand Down

0 comments on commit 91904e9

Please sign in to comment.