mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Create ngbootbox-tests.ts
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
/// <reference path="../angular/angular.d.ts" />
|
||||
/// <reference path="ngbootbox.d.ts" />
|
||||
|
||||
class TestBootboxController {
|
||||
|
||||
constructor(private $scope: angular.IScope, $ngBootbox: IBootboxService) {
|
||||
|
||||
$ngBootbox.alert('An important message!').then(function() {
|
||||
console.log('Alert closed');
|
||||
});
|
||||
|
||||
$ngBootbox.confirm('A question?').then(function() {
|
||||
console.log('Confirmed!');
|
||||
}, function() {
|
||||
console.log('Confirm dismissed!');
|
||||
});
|
||||
|
||||
$ngBootbox.prompt('Enter something').then(function(result) {
|
||||
console.log('Prompt returned: ' + result);
|
||||
}, function() {
|
||||
console.log('Prompt dismissed!');
|
||||
});
|
||||
|
||||
var options: IBootboxDialog = {
|
||||
message: 'This is a message!',
|
||||
title: 'The title!',
|
||||
className: 'test-class',
|
||||
buttons: {
|
||||
warning: {
|
||||
label: "Cancel",
|
||||
className: "btn-warning",
|
||||
callback: function() {
|
||||
console.log('warning callback');
|
||||
}
|
||||
},
|
||||
success: {
|
||||
label: "Ok",
|
||||
className: "btn-success",
|
||||
callback: function() {
|
||||
console.log('sucess callback');
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
$ngBootbox.customDialog(options);
|
||||
}
|
||||
}
|
||||
|
||||
var app = angular.module('testBootbox', ['ngBootbox']);
|
||||
app.controller('TestBootboxCtrl', ['$scope', '$ngBootbox', TestBootboxController]);
|
||||
Reference in New Issue
Block a user