AngularJS Dependency injection in controller of routeProvider resolve
<p>Injecting the return object of a <code>resolve</code> which should be injected into the controller, but it's not. I am using a promise so that the controller does not instanciate until the promise is resolved, since I am doing a HTTP POST using the <code>$http</code> service.</p>

<p>I am also doing some redirection depending on the response data by using <code>$location.path</code>. The first route will redirect to the <code>template1</code> route with the data it has obtained.</p>

<pre><code>$routeProvider
    .when("/auth/:id", amd.route(
    {   
        controller: 'eventController',
        controllerUrl: 'app/controllers/eventController',
        resolve: {
            returnedData: ['$http', '$location', '$route', '$q', function ($http, $location, $route, $q) {
                var id = $route.current.params.id;
                var defer = $q.defer();
                $http({
                    method: 'POST',
                    url: 'http://domain/service/webapi',
                    data: { 'name': id }
                }).then(function (response) {
                    var template = "/template".concat(response.data.displayLayout);
                    defer.resolve(response.data);
                    $location.path(template);
                    return defer.promise;
                });
            }]
        }
    }))
    .when("/template1", amd.route(
    {
        templateUrl: 'views/templates/template1.html',
        controller: 'eventController',
        controllerUrl: 'app/controllers/eventController',
    }));

app.controller('eventController', ['$scope', '$routeParams', '$timeout', 'returnedData',
    function ($scope, $routeParams, $timeout, returnedData) {
        // ...controller code here: $scope.returnedData = returnedData
});
</code></pre>

<p>I am getting the AngularJS error:</p>

<blockquote>
  <p>Error: $injector:unpr Unknown Provider</p>
</blockquote>

<p>Any thoughts on this?</p>