Edit in JSFiddle

var myApp = angular.module('myApp', ['ui.bootstrap']);

myApp.controller('ModalCtrl', ['$scope', '$modal', function ($scope, $modal) {
    $scope.open = function () {
        var modalInstance = $modal.open({
            templateUrl: 'modal.html',
            controller: 'ModalInstanceCtrl',
            resolve: {
                params: function () {
                    return {
                        key: 'value',
                        key2: 'value2'
                    };
                }
            }
        });
        modalInstance.result.then(
			function (result) {
            	console.log('called $modalInstance.close()');
				alert(result);
			},
			function (result) {
				console.log('called $modalInstance.dismiss()');
				alert(result);
			}
		);
	};
}]);

myApp.controller('ModalInstanceCtrl', ['$scope', '$modalInstance', 'params', function ($scope, $modalInstance, params) {
    console.log(params);

    $scope.ok = function () {
        $modalInstance.close('this is result for close');
    };

    $scope.cancel = function () {
        $modalInstance.dismiss('this is result for dismiss');
    };
}]);
<div ng-app="myApp" ng-controller="ModalCtrl">
    <script type="text/ng-template" id="modal.html">
        <div class="modal-header">
            <h3>Modal Header</h3>
        </div>
        <div class="modal-body">
			<p>Modal Body</p>
        </div>
        <div class="modal-footer">
            <button class="btn btn-primary" ng-click="ok()">OK</button>
            <button class="btn btn-warning" ng-click="cancel()">Cancel</button>
        </div>
    </script>
    <button class="btn btn-default" ng-click="open()">Open</button>
</div>

              
            
          
            
              

External resources loaded into this fiddle: