Thursday 24 January 2013

AngularJS: Error: Unknown provider: $configServiceProvider <- $configService

So I'm writing a small app using AngularJS and after reading the awesome tutorial I decided to try it. I started out with their angular-seed app and the first thing I wanted to create was a ConfigService:


In services.js



/* Controllers */

function DailyTipController($scope, $http, $configService) {

//    $http.get('')

    $scope.tip = $configService.version;

}





So far so good right? Nope. When I run my app, this is what I got:

Error: Unknown provider: $configServiceProvider <- anonymous="" at="" configservice="" error="">) at file:///home/tchan/repo/codetipdaily/public/client/app/lib/angular/angular.js:2641:15 at Object.getService [as get]

Alright...what's happening here?

I went through the documentation and found that in addition to registering the the controller, you also need to inject the controller with the right parameters:


In controllers.js


DailyTipController.$inject = ['$scope','$http', 'configService'];





No comments:

Post a Comment