Is there a way to streamline dependencies that are common across multiple Angular Controllers?
For instance, if both the StudentCtrl
and TeacherCtrl
utilize $scope
, $rootScope
, $routeParams
, and $http
, can these be abstracted into a package such as standardDependencies
and then injected into both controllers instead of listing all the shared ones individually?
Example:
app.controller('StudentCtrl', ['standardDependencies', function(standardDependencies){
}]);
I understand that services are typically used for this purpose, but I have not come across any examples demonstrating how to inject things like $scope
, only custom functions.