I get an error: Error: $injector:unpr Unknown Provider

Here is my the code

//app.js
.....
$routeProvider.
                when('/', {
                    templateUrl: 'default.html',
                    controller: 'TestCtrl',
                    resolve: TestCtrl.resolve
                }).
                otherwise({redirectTo: '/'});



//controllers.js
var TestCtrl = app.controller('TestCtrl ', ['$scope', 'loadData', 
function($scope, loadData) {
    $scope.data = loadData;
}]);

TestCtrl.resolve = {
    loadData: function($q, $http) {
        var defer = $q.defer();

        $http.get('/api/data/')
            .success(function(d) {
                defer.resolve(d.data);
            })
            .error(function(d) {
                defer.reject();
            });

        return defer.promise;
    }
}


How to fix this?

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to