Keyword "this" inside angular js controllers

From this URL https://github.com/angular/angular-seed/blob/master/app/js/app.js, I got a controller like below.

function WineListCtrl(Wine) {
    this.wines = Wine.query();
}

So far what I have been doing in angular is define a controller with $scope getting injected. So i tried, changing the above controller to

function WineListCtrl(Wine, $scope) {
    console.log($scope, this)
    this.wines = Wine.query();
}

But this is giving an error Error: Unknown provider for '$scope'.

I have three questions here:

  1. Why the $scope of the controller is not injected.
  2. Does this inside the WineListCtrl means the $scope.
  3. Most of the errors in Angular are of the format 'Unknown provider for XXXX'. What should i look for, if the firebug says so?

  1. When writing your controllers in that form you should inject them with dependencies like so:

    function WineListCtrl(Wine, $scope) { console.log($scope, this) this.wines = Wine.query(); } WineListCtrl.$inject = ['Wine', '$scope'];

  2. this is not the same as $scope. $scope is an angular-specific object created with $rootScope.$new()

  3. See #1

  1. You are using "inferred dependencies" (see DI page) which should work fine, unless you minify or obfuscate your JavaScript.

  2. See my answer to this question: this vs $scope in AngularJS controllers

  3. 'Unknown provider' errors normally occur when you forget to use ng-app somewhere, or you forget to initialize your app with the appropriate module: