Is it possible to connect two different factories to one controller?

  • What version of angularjs do you use? - Max

1 answer 1

Yes, it is possible. You can inject various factory for your controller.

Here is an example written in angular 1:

app.factory('factory1', function(){ return { text: 'text from factory1' } }) app.factory('factory2', function(){ return { text: 'text from factory2' } }) app.controller('MainCtrl', function($scope, factory1, factory2) { $scope.factory1 = factory1; $scope.factory2 = factory2; });