angular-ui/bootstrap — pull request #118 by thiagofelix (2013-02-04 19:13:54+00:00)
Title: Change $dialog service to resolve properties in the same way as $routeProvider.when method does.

Why the 'resolve' property does not work in the same way as [$routeProvider when method does] (http://docs.angularjs.org/api/ng.$routeProvider) . In the $routeProvider, the resolve property must be a map of keys and values following:

* key – {string}: a name of a dependency to be injected into the controller.
* factory - {string|function}: If string then it is an alias for a service. **Otherwise if function, then it is injected and the return value is treated as the dependency. If the result is a promise, it is resolved before its value is injected into the controller**.

When I frist tried to use $dialog i see the resolve options in the documentation, and i used like this:

```javascript
/**
* These are the modal's settings
*/
var myModalOpts = $dialog.dialog({
backdrop: true,
keyboard: true,
backdropClick: true,
templateUrl: 'modal-template.html',
controller: 'ModalCtrl',
resolve: {
listOfThings : function(){
return ThingsService.list();
},
constantValue: function() { return CONSTANT_VALUE; },
}
});

/**
* This are the modal's controller
*/
module.controller('ModalCtrl',['$scope', 'listOfThings', 'constantValue', function($scope, listOfThings, constantValue){
$scope.things = listOfThings;
$scope.constantThing = constantValue;
}]);
```

But the service injected the function into the controller and not the value returned by the promise as dependency.

I suggest to change the way $dialog resolve the dependencies, to do in the same way as $routeProvider does. Code attached