AngularJS $inject Property Annotation


Example

Equivalently, we can use the $inject property annotation to achieve the same as above:

var MyController = function($scope) {
  // ...
}
MyController.$inject = ['$scope'];
myModule.controller('MyController', MyController);