From e7f3e75436523a2c283b9d13fe8c52d117c3db7f Mon Sep 17 00:00:00 2001 From: Sam Saint-Pettersen Date: Fri, 6 Nov 2015 16:23:53 +0000 Subject: [PATCH] Create ngbootbox-tests.ts --- ngbootbox/ngbootbox-tests.ts | 50 ++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 ngbootbox/ngbootbox-tests.ts diff --git a/ngbootbox/ngbootbox-tests.ts b/ngbootbox/ngbootbox-tests.ts new file mode 100644 index 000000000..0b64d6376 --- /dev/null +++ b/ngbootbox/ngbootbox-tests.ts @@ -0,0 +1,50 @@ +/// +/// + +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]);